From the course: Complete Guide to Databricks for Data Engineering
Unlock this course with a free trial
Join today to access over 24,600 courses taught by industry experts.
Use Spark SQL transformations - Databricks Tutorial
From the course: Complete Guide to Databricks for Data Engineering
Use Spark SQL transformations
- [Instructor] Spark SQL transformations provides a huge functionality for the data engineers to play around, to clean the data, to transform the data, to process the data, and to aggregate the data. Now, let's just understand how we can use Spark SQL transformations. So the first thing probably we need is the views, so that we have already created in our previous videos. So we're going to use the same temporary views customer, which we have created in the temporary view video. So let's move forward with this customer view. If I were to select a specific column out of that, I can say df1 is equal to spark.sql select customer_id, name, email, customer_type from this customer view. Remember whenever you run spark.sql and execute any query, the output which you get isn't another DataFrame. So if you want to see that DataFrame, we're going to use Databricks display function to print that DataFrame. And you can see that. We got some specific columns out of that view. So here, the benefit…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
What is Spark SQL?5m 47s
-
(Locked)
Create temporary views in Databricks10m 17s
-
(Locked)
Create global temp views in Databricks7m 25s
-
(Locked)
Use Spark SQL transformations7m
-
(Locked)
Write DataFrames as managed tables in PySpark9m 26s
-
(Locked)
Write a DataFrame as external table in PySpark8m 31s
-
(Locked)
-
-
-
-
-
-
-
-
-