Example2 · ELT with Spark SQL and Python
A finance analyst needs to query a directory of monthly transaction files stored as Parquet without first creating a managed table. Which Spark SQL syntax reads the files directly?
✓SELECT * FROM parquet.`/mnt/finance/transactions` AS monthly_txns
Correct. The `format.`path`` pattern lets Spark SQL query files directly, so parquet.`/path` reads the Parquet directory without a table.
・SELECT * FROM READ('/mnt/finance/transactions')
Incorrect. READ() is not a valid Spark SQL function for querying a file path directly.
・SELECT * FROM FILES('/mnt/finance/transactions')
Incorrect. FILES() is not a Spark SQL construct for reading data files into a query.
・SELECT * FROM OPEN('/mnt/finance/transactions')
Incorrect. OPEN is not valid Spark SQL syntax for reading a file-based source.
Explanation
Spark SQL supports querying files directly with the pattern `format.`path``, for example parquet.`/path`, which is useful for ad hoc exploration before building tables.
Example3 · Incremental Data Processing
A logistics company lands new shipment-manifest CSV files into a cloud storage folder every few minutes. An engineer wants to ingest only the newly arrived files into a Delta table on a recurring schedule, without reprocessing files that were already loaded, using a simple SQL command rather than a streaming job. Which command best meets this requirement?
✓COPY INTO shipments FROM '/mnt/landing/manifests' FILEFORMAT = CSV FORMAT_OPTIONS ('header' = 'true') COPY_OPTIONS ('force' = 'false')
Correct. COPY INTO is an idempotent, retriable SQL command that tracks which files have already been ingested and loads only new files on each run.
・INSERT INTO shipments SELECT * FROM csv.`/mnt/landing/manifests`
Incorrect. A plain INSERT INTO over a directory reloads every file each time it runs, so already-processed manifests would be duplicated.
・CREATE TABLE shipments AS SELECT * FROM csv.`/mnt/landing/manifests`
Incorrect. CREATE TABLE AS replaces or recreates the table from the full directory and does not perform incremental, file-level loading.
・MERGE INTO shipments USING csv.`/mnt/landing/manifests` ON false WHEN NOT MATCHED THEN INSERT *
Incorrect. This MERGE reads the entire directory on every run and has no mechanism to skip files that were already ingested.
Explanation
COPY INTO is the recommended idempotent SQL idiom for incrementally loading only newly arrived files into a Delta table. It keeps metadata about files it has already processed, so repeated runs skip previously loaded data.
Example4 · Production Pipelines
A gaming telemetry team runs a Databricks Job with three tasks: ingest_sessions, enrich_sessions, and publish_dashboard_tables. The enrich task must run only after ingest completes successfully, and publish must run only after enrich completes successfully. How should the engineer configure the Job so the tasks execute in that strict order within a single job run?
・Separate jobs chained by three independent schedules offset a few minutes apart so each one hopefully starts after the previous finishes running
Incorrect. Time-offset independent schedules do not guarantee ordering and break if any step runs long, so dependencies are not actually enforced.
✓Define all three tasks in one job and set 'Depends on' so enrich depends on ingest and publish depends on enrich
Correct. Task dependencies via 'Depends on' create a DAG where a downstream task starts only after its upstream dependency succeeds, enforcing the required order.
・Define all three tasks with no dependencies and rely on alphabetical task-name ordering
Incorrect. Databricks Jobs do not order tasks by name; without an explicit dependency the tasks would run in parallel.
・Define the three tasks as a single %run notebook because Jobs cannot express task ordering
Incorrect. Jobs fully support multi-task ordering through dependencies, so collapsing everything into one %run notebook is unnecessary and loses per-task retries and monitoring.
Explanation
Multi-task Databricks Jobs model execution as a DAG. The 'Depends on' setting makes a task wait for its upstream dependency to succeed, which is the correct way to enforce ingest to enrich to publish ordering in one run.
Example5 · Data Governance (Unity Catalog)
A national energy regulator is onboarding Unity Catalog to govern smart-meter data. An engineer must create a three-level reference to a table named 'readings' that lives in the 'smart_meter' schema under the 'grid_prod' catalog so a query can run against it. Which fully qualified name correctly identifies this table in the Unity Catalog hierarchy?
✓Address it as grid_prod.smart_meter.readings in catalog.schema.table order
Correct. Unity Catalog uses the three-level namespace catalog.schema.table, so grid_prod.smart_meter.readings is the correct fully qualified name.
・Use smart_meter.grid_prod.readings in reversed schema-then-catalog order instead of catalog first
Incorrect. The catalog must come first, not the schema, so the order grid_prod then smart_meter is required.
・The readings table living inside the grid_prod.smart_meter path
Incorrect. This is prose rather than a valid dotted three-level identifier that a query can resolve.
・hive_metastore.grid_prod.readings via the legacy two-level metastore
Incorrect. hive_metastore is the legacy two-level metastore and does not sit above the grid_prod catalog here.
Explanation
Unity Catalog organizes objects as metastore > catalog > schema > table, so a table is addressed as catalog.schema.table. Only grid_prod.smart_meter.readings follows that order.