QuestionQ99

VerifiedData Governance & Quality

A data analyst has developed a query that runs against Delta table. They want help from the data engineering team to implement a series of tests to ensure the data returned by the query is clean. However, the data engineering team uses Python for its tests rather than SQL.

Which of the following operations could the data engineering team use to run the query and operate with the results in PySpark?

Explanation

Since the analyst already wrote the logic as a SQL query, the engineering team can execute that exact query string from PySpark with spark.sql(query), which returns a DataFrame they can then manipulate and test with standard PySpark APIs. spark.table() only loads a named table as a DataFrame without running a query, 'SELECT * FROM sales' is not valid Python syntax on its own, and spark.delta.table is not a real Spark API.

Community Discussion

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