Give a DataFrame a name, query it with SQL, and learn where Spark keeps tables, views and their metadata.
SQL refers to tables by name, but a DataFrame is just a Python variable. df.createOrReplaceTempView("orders") bridges the two: it registers the name orders in the session's catalog, pointing at the DataFrame's query plan.
Nothing is copied or computed. A temp view is a saved query, not a saved result — every query against orders reads the Parquet files again (unless you cache it). OrReplace means re-running the cell swaps the definition instead of failing because the name already exists.
orders = spark.read.parquet("s3://lake/orders/")
customers = spark.read.parquet("s3://lake/customers/")
products = spark.read.parquet("s3://lake/products/")
orders.createOrReplaceTempView("orders")
customers.createOrReplaceTempView("customers")
products.createOrReplaceTempView("products")
# orders(order_id, customer_id, product_id, qty, amount, order_date, status)
# customers(customer_id, name, country, signup_date, tier)
# products(product_id, name, category, price)Reach the last step for the run summary: the key takeaways from this lesson.