7 Bilingual PySpark: Blending Python and SQL code

This chapter covers

  • Drawing a parallel between PySpark’s instruction set and the SQL vocabulary
  • Registering data frames as temporary views or tables to query them using Spark SQL
  • Using the catalog to create, reference, and delete registered tables for SQL querying
  • Translating common data manipulations instructions from Python to SQL, and vice versa
  • Using SQL-style clauses inside certain PySpark methods

My answer to the question “Python versus SQL, which one should I learn?” is “both.”

When it comes to manipulating tabular data, SQL is the reigning king. For multiple decades now, it has been the workhorse language for relational databases, and even today, learning how to tame it is a worthwhile ...

Get Data Analysis with Python and PySpark now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.