DATABRICKS-CERTIFIED-DATA-ENGINEER-ASSOCIATE · Question #83
A data analyst has created a Delta table sales that is used by the entire data analysis team. They want help from the data engineering team to implement a series of tests to ensure the data is…
The correct answer is E. spark.table("sales"). Databricks uses a unified metastore, meaning tables registered in SQL are also accessible via PySpark using spark.table('table_name'), which returns a DataFrame. This is the standard PySpark API for loading a named table. SELECT * FROM sales is SQL syntax, not PySpark…
Question
Options
- ASELECT * FROM sales
- BThere is no way to share data between PySpark and SQL.
- Cspark.sql("sales")
- Dspark.delta.table("sales")
- Espark.table("sales")
How the community answered
(47 responses)- B2% (1)
- C4% (2)
- D6% (3)
- E87% (41)
Explanation
Databricks uses a unified metastore, meaning tables registered in SQL are also accessible via PySpark using spark.table('table_name'), which returns a DataFrame. This is the standard PySpark API for loading a named table. SELECT * FROM sales is SQL syntax, not PySpark. spark.sql('sales') is incorrect - spark.sql() requires a full SQL statement string, not just a table name. spark.delta.table() is not a valid PySpark method. The claim that PySpark and SQL cannot share data is false - they share the same metastore and can interoperate seamlessly.
Topics
Community Discussion
No community discussion yet for this question.