QuestionQ146

VerifiedData Governance & Quality

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 clean. However, the data engineering team uses Python for its tests rather than SQL.

Which command could the data engineering team use to access sales in PySpark?

Explanation

spark.table("sales") returns the named table as a PySpark DataFrame, which is the idiomatic way to reference a Delta or metastore table from Python code. spark.sql("sales") is invalid because spark.sql() expects a full SQL query string rather than a bare table name, and spark.delta.table() is not a real Spark API.

Community Discussion

No comments yet. Be the first to start the discussion!