CertLumen

Databricks Data Analyst Associate · Section 4 · 20% of the exam

Use Delta Lake's time travel to access and query historical data versions.

One of the objectives of the Databricks Certified Data Analyst Associate exam, in the section “Executing queries using Databricks SQL and Databricks SQL Warehouses”. Here is what it covers, the points to remember and a question to try.

What it covers

Unity Catalog has two kinds of tables: managed tables, where Unity Catalog owns the files, and external tables, where you own them. This lesson covers how to create each, what DROP does, how one CREATE TABLE AS SELECT can unify CSV, Parquet and Delta sources, and how Delta time travel lets you audit, query and restore earlier versions of a table.

Points to remember

  • Managed tables are the default and recommended type: no LOCATION, Delta (or Iceberg), files in Unity Catalog managed storage, eligible for predictive optimization.
  • External tables use LOCATION inside a Unity Catalog external location and need CREATE EXTERNAL TABLE; they support Delta, CSV, JSON, Avro, Parquet, ORC and text.
  • Dropping a managed table purges its data after a recovery period (7 days by default; UNDROP TABLE); dropping an external table leaves the files in place.
  • CTAS derives the schema from the query (no column list); CREATE OR REPLACE keeps history and grants; IF NOT EXISTS and OR REPLACE cannot be combined.
  • read_files reads CSV, Parquet, JSON and other formats from volumes; joining it with Delta tables in one CTAS builds a unified table; it needs READ VOLUME.

Try a question

An analyst builds workspace.daa_lab.customers_unified with a CTAS that reads CSV files from a volume through read_files. Auditors require every row of the new table to record the file it was loaded from. What should she add to the query?

  1. ASelect _metadata.file_path from the read_files source as an extra column
  2. BAdd a LOCATION clause so that Unity Catalog tracks each row's source file
  3. CEnable change data feed on the new table to record where each row came from
  4. DRun DESCRIBE HISTORY after the CTAS and store its output next to the table
Show the answer

A. File-based sources such as read_files expose a hidden _metadata column. Selecting _metadata.file_path, for example AS source_file, stores the path of the file each row came from. Table history and change data feed record table versions and row changes, not the source file of each row.

Written for practice in the style of the exam: never a question from the real exam.

In the course

The lesson Managed and External Tables, CTAS and Delta Time Travel teaches this objective (about 45 minutes), and 9 practice questions test it. The course has lessons, exam-style questions, timed practice exams and an AI tutor for every objective, and a pass prediction that tells you when you're ready to book.

More in this section

← Previous objective · All 39 objectives · Next objective →