SQL to Spark SQL Python Syntax

To aid Data Engineers converting from SQL to Python, the table below lists common data operations.

SQLPython
SELECT name
FROM customers
df = spark.read.json("examples/src/main/resources/people.json")

df.select("name").show()
SELECT name
FROM customers
WHERE age > 21
df.filter(df['age'] > 21).show()

Tags:

Comments are closed