Snowflake Cookbook

Book description

Develop modern solutions with Snowflake's unique architecture and integration capabilities; process bulk and real-time data into a data lake; and leverage time travel, cloning, and data-sharing features to optimize data operations

Key Features

  • Build and scale modern data solutions using the all-in-one Snowflake platform
  • Perform advanced cloud analytics for implementing big data and data science solutions
  • Make quicker and better-informed business decisions by uncovering key insights from your data

Book Description

Snowflake is a unique cloud-based data warehousing platform built from scratch to perform data management on the cloud. This book introduces you to Snowflake's unique architecture, which places it at the forefront of cloud data warehouses.

You'll explore the compute model available with Snowflake, and find out how Snowflake allows extensive scaling through the virtual warehouses. You will then learn how to configure a virtual warehouse for optimizing cost and performance. Moving on, you'll get to grips with the data ecosystem and discover how Snowflake integrates with other technologies for staging and loading data.

As you progress through the chapters, you will leverage Snowflake's capabilities to process a series of SQL statements using tasks to build data pipelines and find out how you can create modern data solutions and pipelines designed to provide high performance and scalability. You will also get to grips with creating role hierarchies, adding custom roles, and setting default roles for users before covering advanced topics such as data sharing, cloning, and performance optimization.

By the end of this Snowflake book, you will be well-versed in Snowflake's architecture for building modern analytical solutions and understand best practices for solving commonly faced problems using practical recipes.

What you will learn

  • Get to grips with data warehousing techniques aligned with Snowflake's cloud architecture
  • Broaden your skills as a data warehouse designer to cover the Snowflake ecosystem
  • Transfer skills from on-premise data warehousing to the Snowflake cloud analytics platform
  • Optimize performance and costs associated with a Snowflake solution
  • Stage data on object stores and load it into Snowflake
  • Secure data and share it efficiently for access
  • Manage transactions and extend Snowflake using stored procedures
  • Extend cloud data applications using Spark Connector

Who this book is for

This book is for data warehouse developers, data analysts, database administrators, and anyone involved in designing, implementing, and optimizing a Snowflake data warehouse. Knowledge of data warehousing and database and cloud concepts will be useful. Basic familiarity with Snowflake is beneficial, but not necessary.

Table of contents

  1. Snowflake Cookbook
  2. Contributors
  3. About the authors
  4. About the reviewers
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
    4. Download the color images
    5. Conventions used
    6. Sections
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
      5. See also
    7. Get in touch
    8. Reviews
  6. Chapter 1: Getting Started with Snowflake
    1. Technical requirements
    2. Creating a new Snowflake instance
      1. Getting ready
      2. How to do it…
      3. How it works…
    3. Creating a tailored multi-cluster virtual warehouse
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    4. Using the Snowflake WebUI and executing a query
      1. Getting ready
      2. How to do it…
      3. How it works…
    5. Using SnowSQL to connect to Snowflake
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    6. Connecting to Snowflake with JDBC
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    7. Creating a new account admin user and understanding built-in roles
      1. How to do it…
      2. How it works…
      3. There's more…
  7. Chapter 2: Managing the Data Life Cycle
    1. Technical requirements
    2. Managing a database
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    3. Managing a schema
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    4. Managing tables
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    5. Managing external tables and stages
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    6. Managing views in Snowflake
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
  8. Chapter 3: Loading and Extracting Data into and out of Snowflake
    1. Technical requirements
    2. Configuring Snowflake access to private S3 buckets
      1. Getting ready
      2. How to do it…
      3. How it works…
    3. Loading delimited bulk data into Snowflake from cloud storage
      1. Getting ready
      2. How to do it…
      3. How it works…
    4. Loading delimited bulk data into Snowflake from your local machine
      1. Getting ready
      2. How to do it…
      3. How it works…
    5. Loading Parquet files into Snowflake
      1. Getting ready
      2. How to do it…
      3. How it works…
    6. Making sense of JSON semi-structured data and transforming to a relational view
      1. Getting ready
      2. How to do it…
      3. How it works…
    7. Processing newline-delimited JSON (or NDJSON) into a Snowflake table
      1. Getting ready
      2. How to do it…
      3. How it works…
    8. Processing near real-time data into a Snowflake table using Snowpipe
      1. Getting ready
      2. How to do it…
      3. How it works…
    9. Extracting data from Snowflake
      1. Getting ready
      2. How to do it…
      3. How it works…
  9. Chapter 4: Building Data Pipelines in Snowflake
    1. Technical requirements
    2. Creating and scheduling a task
      1. Getting ready
      2. How it works…
    3. Conjugating pipelines through a task tree
      1. Getting ready
      2. How to do it…
      3. How it works…
    4. Querying and viewing the task history
      1. Getting ready
      2. How to do it…
      3. How it works…
    5. Exploring the concept of streams to capture table-level changes
      1. Getting ready
      2. How to do it…
      3. How it works…
    6. Combining the concept of streams and tasks to build pipelines that process changed data on a schedule
      1. How to do it…
      2. How it works…
    7. Converting data types and Snowflake's failure management
      1. How to do it…
      2. How it works…
      3. There's more…
    8. Managing context using different utility functions
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
  10. Chapter 5: Data Protection and Security in Snowflake
    1. Technical requirements
    2. Setting up custom roles and completing the role hierarchy
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    3. Configuring and assigning a default role to a user
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    4. Delineating user management from security and role management
      1. Getting ready
      2. How to do it…
      3. How it works…
    5. Configuring custom roles for managing access to highly secure data
      1. Getting ready
      2. How to do it…
      3. How it works…
    6. Setting up development, testing, pre-production, and production database hierarchies and roles
      1. Getting ready
      2. How to do it…
      3. How it works…
    7. Safeguarding the ACCOUNTADMIN role and users in the ACCOUNTADMIN role
      1. Getting ready
      2. How to do it…
      3. How it works…
  11. Chapter 6: Performance and Cost Optimization
    1. Technical requirements
    2. Examining table schemas and deriving an optimal structure for a table
      1. Getting ready
      2. How to do it…
      3. How it works…
    3. Identifying query plans and bottlenecks
      1. Getting ready
      2. How to do it…
      3. How it works…
    4. Weeding out inefficient queries through analysis
      1. Getting ready
      2. How to do it…
      3. How it works…
    5. Identifying and reducing unnecessary Fail-safe and Time Travel storage usage
      1. Getting ready
      2. How to do it…
      3. How it works…
    6. Projections in Snowflake for performance
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. There's more…
    7. Reviewing query plans to modify table clustering
      1. Getting ready
      2. How to do it…
      3. How it works…
    8. Optimizing virtual warehouse scale
      1. Getting ready
      2. How to do it…
      3. How it works…
  12. Chapter 7: Secure Data Sharing
    1. Technical requirements
    2. Sharing a table with another Snowflake account
      1. Getting ready
      2. How to do it…
      3. How it works…
    3. Sharing data through a view with another Snowflake account
      1. Getting ready
      2. How to do it…
      3. How it works…
    4. Sharing a complete database with another Snowflake account and setting up future objects to be shareable
      1. Getting ready
      2. How to do it…
      3. How it works…
    5. Creating reader accounts and configuring them for non-Snowflake sharing
      1. Getting ready
      2. How to do it…
      3. How it works…
      4. Getting ready
      5. How to do it…
      6. How it works…
    6. Keeping costs in check when sharing data with non-Snowflake users
      1. Getting ready
      2. How to do it…
      3. How it works…
  13. Chapter 8: Back to the Future with Time Travel
    1. Technical requirements
    2. Using Time Travel to return to the state of data at a particular time
      1. Getting ready
      2. How to do it…
      3. How it works…
    3. Using Time Travel to recover from the accidental loss of table data
      1. Getting ready
      2. How to do it…
      3. How it works…
    4. Identifying dropped databases, tables, and other objects and restoring them using Time Travel
      1. Getting ready
      2. How to do it…
      3. How it works…
    5. Using Time Travel in conjunction with cloning to improve debugging
      1. Getting ready
      2. How to do it…
      3. How it works…
    6. Using cloning to set up new environments based on the production environment rapidly
      1. Getting ready
      2. How to do it…
      3. How it works…
  14. Chapter 9: Advanced SQL Techniques
    1. Technical requirements
    2. Managing timestamp data
      1. Getting ready
      2. How to do it…
      3. How it works…
    3. Shredding date data to extract Calendar information
      1. Getting ready
      2. How to do it…
      3. How it works…
    4. Unique counts and Snowflake
      1. Getting ready
      2. How to do it…
      3. How it works…
    5. Managing transactions in Snowflake
      1. Getting ready
      2. How to do it…
      3. How it works…
    6. Ordered analytics over window frames
      1. Getting ready
      2. How to do it…
      3. How it works…
    7. Generating sequences in Snowflake
      1. Getting ready
      2. How to do it…
      3. How it works…
  15. Chapter 10: Extending Snowflake Capabilities
    1. Technical requirements
    2. Creating a Scalar user-defined function using SQL
      1. Getting ready
      2. How to do it...
      3. How it works...
    3. Creating a Table user-defined function using SQL
      1. Getting ready
      2. How to do it
      3. How it works
    4. Creating a Scalar user-defined function using JavaScript
      1. Getting ready
      2. How to do it
      3. How it works
    5. Creating a Table user-defined function using JavaScript
      1. Getting ready
      2. How to do it
      3. How it works
    6. Connecting Snowflake with Apache Spark
      1. Getting ready
      2. How to do it
      3. How it works
    7. Using Apache Spark to prepare data for storage on Snowflake
      1. Getting ready
      2. How to do it
      3. How it works
    8. Why subscribe?
  16. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Leave a review - let other readers know what you think

Product information

  • Title: Snowflake Cookbook
  • Author(s): Hamid Mahmood Qureshi, Hammad Sharif
  • Release date: February 2021
  • Publisher(s): Packt Publishing
  • ISBN: 9781800560611