Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Snowflake Cookbook

You're reading from  Snowflake Cookbook

Product type Book
Published in Feb 2021
Publisher Packt
ISBN-13 9781800560611
Pages 330 pages
Edition 1st Edition
Languages
Authors (2):
Hamid Mahmood Qureshi Hamid Mahmood Qureshi
Profile icon Hamid Mahmood Qureshi
Hammad Sharif Hammad Sharif
Profile icon Hammad Sharif
View More author details

Table of Contents (12) Chapters

Preface 1. Chapter 1: Getting Started with Snowflake 2. Chapter 2: Managing the Data Life Cycle 3. Chapter 3: Loading and Extracting Data into and out of Snowflake 4. Chapter 4: Building Data Pipelines in Snowflake 5. Chapter 5: Data Protection and Security in Snowflake 6. Chapter 6: Performance and Cost Optimization 7. Chapter 7: Secure Data Sharing 8. Chapter 8: Back to the Future with Time Travel 9. Chapter 9: Advanced SQL Techniques 10. Chapter 10: Extending Snowflake Capabilities 11. Other Books You May Enjoy

Using Apache Spark to prepare data for storage on Snowflake

This recipe provides you with an example of how Apache Spark and Snowflake partner to utilize the two systems' strengths. The recipe shows a scenario involving reading data from Snowflake into a Spark DataFrame and writing data back to Snowflake from a Spark DataFrame.

Getting ready

You will need to be connected to your Snowflake instance via the Web UI or the SnowSQL client to execute this recipe.

It is assumed that you have already configured the Snowflake Connector for Spark and can connect to the Snowflake instance successfully through Spark.

How to do it

We will be reading data from Snowflake sample tables and transforming the data before writing it back to Snowflake in a new table. The following code in the various steps should be added into a single scala file called snowflake_transform.scala since we will be calling that file from within spark-shell:

  1. Let's start by creating a new database...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}