Databricks Advanced
Unity Catalog governance with code, SCD Type 2 two ways (tested Delta MERGE and Lakeflow AUTO CDC), declarative pipelines, advanced streaming, performance, Asset Bundles, sharing and a quick-reference table.
1. The Databricks Platform in One Picture
This card covers the advanced topics architects and senior data engineers are asked about. The fundamentals (DataFrames, tuning, Auto Loader basics, cluster sizing) are in the Spark & Databricks guide.
CONTROL PLANE (Databricks account) DATA PLANE (your cloud account or serverless) workspace UI, notebooks, jobs, pipelines clusters / SQL warehouses / serverless compute Unity Catalog metastore (one per region) reads/writes your S3, ADLS or GCS storage GOVERNANCE Unity Catalog: catalogs, permissions, row filters, masks, lineage, audit STORAGE Delta Lake tables (also readable as Iceberg via UniForm), volumes for files INGEST Auto Loader, Lakeflow Connect, Kafka / Kinesis streaming, Lakehouse Federation TRANSFORM Spark + Photon, Lakeflow Declarative Pipelines, Spark Structured Streaming ORCHESTRATE Lakeflow Jobs, Databricks Asset Bundles for CI/CD SERVE Databricks SQL warehouses, Delta Sharing, Mosaic AI model serving
2. Unity Catalog in Practice
Unity Catalog (UC) is the governance layer for everything in Databricks: tables, views, volumes (files), functions and models. Objects use a three-level name catalog.schema.object, permissions are granted to account-level groups, and lineage and audit are captured automatically.
Securables and the permission model
| Securable | Purpose | Key privilege |
|---|---|---|
| Metastore | Top container, one per region | Admin rights |
| Catalog | Domain or environment (e.g. prod_sales) | USE CATALOG |
| Schema | Layer or subject area (bronze, silver, gold) | USE SCHEMA, CREATE TABLE |
| Table / view | Data | SELECT, MODIFY |
| Volume | Files (landing zones, ML artefacts) | READ VOLUME, WRITE VOLUME |
| Storage credential | Cloud IAM role or managed identity | CREATE EXTERNAL LOCATION |
| External location | A storage path governed by UC | READ FILES, CREATE EXTERNAL TABLE |
Privileges are inherited downwards, but a user needs USE CATALOG and USE SCHEMA on the parents as well as SELECT on the table. Forgetting USE privileges is the most common "permission denied" in UC.
Set up a governed domain
-- 1. connect cloud storage once, through a storage credential (IAM role / managed identity) CREATE EXTERNAL LOCATION sales_landing URL 's3://acme-sales-landing/' WITH (STORAGE CREDENTIAL acme_sales_role); -- 2. catalog per domain and environment, schemas per layer CREATE CATALOG IF NOT EXISTS prod_sales MANAGED LOCATION 's3://acme-uc-managed/prod_sales'; CREATE SCHEMA IF NOT EXISTS prod_sales.bronze; CREATE SCHEMA IF NOT EXISTS prod_sales.silver; CREATE SCHEMA IF NOT EXISTS prod_sales.gold; CREATE VOLUME IF NOT EXISTS prod_sales.bronze.landing; -- governed file area -- 3. grant to groups, never to individuals GRANT USE CATALOG ON CATALOG prod_sales TO `sales-analysts`; GRANT USE SCHEMA, SELECT ON SCHEMA prod_sales.gold TO `sales-analysts`; GRANT USE SCHEMA, SELECT, MODIFY ON SCHEMA prod_sales.silver TO `sales-engineers`; -- the pipeline's service principal owns its catalog GRANT ALL PRIVILEGES ON CATALOG prod_sales TO `sales-platform-sp`;
Unity Catalog SQL: follows the Databricks documentation but needs a Databricks workspace, so it was not executed here.
Row filters and column masks
Fine-grained security is a SQL function attached to a table: the row filter returns TRUE for rows the user may see, the mask returns the value the user may see. Both apply in every engine and tool that reads the table through UC.
-- rows: India team sees Indian customers; admins see everything
CREATE OR REPLACE FUNCTION prod_sales.gold.region_filter(region STRING)
RETURN is_account_group_member('sales-admins') OR region = 'IN';
ALTER TABLE prod_sales.gold.dim_customer
SET ROW FILTER prod_sales.gold.region_filter ON (region);
-- columns: only pii-readers see full email addresses
CREATE OR REPLACE FUNCTION prod_sales.gold.mask_email(email STRING)
RETURN CASE WHEN is_account_group_member('pii-readers') THEN email
ELSE regexp_replace(email, '^[^@]+', '***') END;
ALTER TABLE prod_sales.gold.dim_customer
ALTER COLUMN email SET MASK prod_sales.gold.mask_email;
-- tag sensitive columns so policies and catalog search can find them
ALTER TABLE prod_sales.gold.dim_customer ALTER COLUMN email SET TAGS ('pii' = 'email');
Row filter and mask functions: follows the Databricks documentation but needs a Databricks workspace, so it was not executed here.
At scale, attach policies to governed tags (attribute-based access control) rather than to individual tables: a new table tagged pii=email is protected the moment it is tagged. The Enterprise Data Architect guide covers ABAC in depth.
Lineage, audit and cost from system tables
-- who read the customer table in the last 7 days?
SELECT event_time, user_identity.email, action_name
FROM system.access.audit
WHERE action_name IN ('getTable', 'commandSubmit')
AND request_params.full_name_arg = 'prod_sales.gold.dim_customer'
AND event_date >= current_date() - 7;
-- what feeds the revenue table? (table-level lineage)
SELECT DISTINCT source_table_full_name, entity_type
FROM system.access.table_lineage
WHERE target_table_full_name = 'prod_sales.gold.fact_revenue';
-- DBU usage by job over the last 30 days
SELECT usage_metadata.job_id, sku_name, SUM(usage_quantity) AS dbus
FROM system.billing.usage
WHERE usage_date >= current_date() - 30
GROUP BY ALL ORDER BY dbus DESC;
System table queries: follows the Databricks documentation but needs a Databricks workspace, so it was not executed here.
"Unity Catalog gives one governance layer: a three-level namespace, grants to groups (with USE CATALOG and USE SCHEMA on parents), storage credentials and external locations instead of cloud keys in code, volumes for files, row filters and column masks as SQL functions, governed tags for attribute-based policies, and automatic lineage and audit in system tables."
3. SCD Type 2: Two Ways on Databricks
Slowly Changing Dimension Type 2 keeps full history: when a tracked attribute changes, the current row is closed (valid_to, is_current = false) and a new version is inserted. Facts join to the version valid at their event time, so old sales stay with the old city.
| Approach | When to use | You write |
|---|---|---|
| Delta MERGE (below) | Batch snapshots or CDC in jobs and notebooks; full control; also works on open-source Delta | The MERGE pattern |
| Lakeflow AUTO CDC (STORED AS SCD TYPE 2) | CDC feeds in Lakeflow Declarative Pipelines; handles ordering and late data | Keys and a sequence column |
Method 1: a single, idempotent Delta MERGE
The trick: one MERGE must both update the old row and insert the new version for the same key, but a source row can only do one. So the source is the updates twice: once with the real key (to close the old row) and once with a NULL key for changed rows only (which never matches, so it inserts). A hash of the tracked columns detects real changes, so unchanged rows and reruns do nothing.
from pyspark.sql import functions as F
spark.sql("""
CREATE TABLE dim_customer (
customer_sk BIGINT, customer_id STRING, name STRING, city STRING, segment STRING,
row_hash STRING, valid_from TIMESTAMP, valid_to TIMESTAMP,
is_current BOOLEAN) USING DELTA""")
spark.sql("""
INSERT INTO dim_customer VALUES
(1, 'C1', 'Asha', 'Pune', 'Retail', sha2('Asha|Pune|Retail', 256),
TIMESTAMP'2026-01-01', NULL, true),
(2, 'C2', 'Ravi', 'Delhi', 'SME', sha2('Ravi|Delhi|SME', 256),
TIMESTAMP'2026-01-01', NULL, true)""")
# today's snapshot from the source: Asha moved city, Ravi unchanged, Meera is new
spark.createDataFrame([
("C1", "Asha", "Mumbai", "Retail", "2026-03-01 00:00:00"),
("C2", "Ravi", "Delhi", "SME", "2026-03-01 00:00:00"),
("C3", "Meera", "Chennai", "Retail", "2026-03-01 00:00:00"),
], "customer_id STRING, name STRING, city STRING, segment STRING, changed_at STRING") \
.withColumn("changed_at", F.to_timestamp("changed_at")) \
.withColumn("row_hash", F.sha2(F.concat_ws("|", "name", "city", "segment"), 256)) \
.createOrReplaceTempView("updates")
SCD2_MERGE = """
MERGE INTO dim_customer t
USING (
-- 1) every incoming row, keyed so it meets its current version
SELECT u.customer_id AS merge_key, u.* FROM updates u
UNION ALL
-- 2) changed rows again with a NULL key: no match, so they INSERT
SELECT NULL AS merge_key, u.*
FROM updates u JOIN dim_customer d
ON d.customer_id = u.customer_id AND d.is_current AND d.row_hash <> u.row_hash
) s
ON t.customer_id = s.merge_key AND t.is_current
WHEN MATCHED AND t.row_hash <> s.row_hash THEN -- close the old version
UPDATE SET valid_to = s.changed_at, is_current = false
WHEN NOT MATCHED THEN -- new customers + new versions
INSERT (customer_sk, customer_id, name, city, segment, row_hash,
valid_from, valid_to, is_current)
VALUES (NULL, s.customer_id, s.name, s.city, s.segment, s.row_hash,
s.changed_at, NULL, true)
"""
print(spark.sql(SCD2_MERGE).select("num_updated_rows", "num_inserted_rows").first())
# surrogate keys for new rows (on Databricks use an IDENTITY column instead)
spark.sql("""
MERGE INTO dim_customer t
USING (SELECT customer_id, valid_from,
(SELECT MAX(customer_sk) FROM dim_customer)
+ ROW_NUMBER() OVER (ORDER BY customer_id) AS sk
FROM dim_customer WHERE customer_sk IS NULL) s
ON t.customer_id = s.customer_id AND t.valid_from = s.valid_from
WHEN MATCHED THEN UPDATE SET customer_sk = s.sk""")
cols = ["customer_sk", "customer_id", "city", "valid_from", "valid_to", "is_current"]
spark.table("dim_customer").select(cols).orderBy("customer_id", "valid_from").show()
rerun = spark.sql(SCD2_MERGE).select("num_updated_rows", "num_inserted_rows").first()
print("rerun changes:", rerun)
spark.sql("""SELECT customer_id, city FROM dim_customer
WHERE TIMESTAMP'2026-02-15' >= valid_from
AND (valid_to IS NULL OR TIMESTAMP'2026-02-15' < valid_to)
ORDER BY customer_id""").show()Row(num_updated_rows=1, num_inserted_rows=2) +-----------+-----------+-------+-------------------+-------------------+----------+ |customer_sk|customer_id| city| valid_from| valid_to|is_current| +-----------+-----------+-------+-------------------+-------------------+----------+ | 1| C1| Pune|2026-01-01 00:00:00|2026-03-01 00:00:00| false| | 3| C1| Mumbai|2026-03-01 00:00:00| NULL| true| | 2| C2| Delhi|2026-01-01 00:00:00| NULL| true| | 4| C3|Chennai|2026-03-01 00:00:00| NULL| true| +-----------+-----------+-------+-------------------+-------------------+----------+ rerun changes: Row(num_updated_rows=0, num_inserted_rows=0) +-----------+-----+ |customer_id| city| +-----------+-----+ | C1| Pune| | C2|Delhi| +-----------+-----+
| What the test shows | Result |
|---|---|
| Asha moved Pune → Mumbai | Old row closed at 2026-03-01, new current row inserted |
| Ravi unchanged | Untouched (the hash matched) |
| Meera is new | Inserted as current |
| Running the same MERGE again | 0 updated, 0 inserted: idempotent |
| Point-in-time query for 2026-02-15 | Asha in Pune, as she was then |
Run on Spark 3.5 with Delta Lake 3.2. On Databricks, define customer_sk BIGINT GENERATED ALWAYS AS IDENTITY so surrogate keys are assigned automatically, and drop the second MERGE. If one batch can contain several changes for the same key, keep only the latest per key first (ROW_NUMBER over changed_at), or MERGE fails with "multiple source rows matched".
Method 2: Lakeflow Declarative Pipelines AUTO CDC
-- Lakeflow Declarative Pipelines (SQL): the pipeline engine does the SCD2 bookkeeping CREATE OR REFRESH STREAMING TABLE silver.dim_customer; CREATE FLOW customer_scd2 AS AUTO CDC INTO silver.dim_customer FROM STREAM(bronze.customer_cdc) KEYS (customer_id) APPLY AS DELETE WHEN operation = 'DELETE' SEQUENCE BY change_seq -- orders events, so late arrivals are handled COLUMNS * EXCEPT (operation, change_seq) STORED AS SCD TYPE 2;
# the same in Python
from pyspark import pipelines as dp
from pyspark.sql import functions as F
dp.create_streaming_table("silver.dim_customer")
dp.create_auto_cdc_flow(
target="silver.dim_customer",
source="bronze.customer_cdc",
keys=["customer_id"],
sequence_by=F.col("change_seq"),
apply_as_deletes=F.expr("operation = 'DELETE'"),
except_column_list=["operation", "change_seq"],
stored_as_scd_type=2,
)
Lakeflow Declarative Pipelines code: follows the Databricks documentation but needs a Databricks workspace, so it was not executed here.
AUTO CDC was called APPLY CHANGES INTO before 2025, and older material still uses that name. It adds __START_AT and __END_AT columns instead of valid_from and valid_to, and it can track history on selected columns only.
"For SCD2 on Databricks I either write a single idempotent Delta MERGE, where the source is unioned with itself so changed keys both close the old row and insert a new version, with a row hash to ignore unchanged rows and identity columns for surrogate keys, or, for CDC feeds, use Lakeflow AUTO CDC with STORED AS SCD TYPE 2 and a sequence column to handle out-of-order events."
4. Lakeflow Declarative Pipelines
Declarative pipelines (formerly Delta Live Tables) let you declare what tables should contain; the engine works out dependencies, incremental processing, retries, data quality and infrastructure.
-- bronze: incremental file ingestion with Auto Loader
CREATE OR REFRESH STREAMING TABLE bronze.orders
AS SELECT *, _metadata.file_path AS source_file, current_timestamp() AS ingested_at
FROM STREAM read_files('/Volumes/prod_sales/bronze/landing/orders/', format => 'json');
-- silver: quality rules live with the table
CREATE OR REFRESH STREAMING TABLE silver.orders (
CONSTRAINT valid_id EXPECT (order_id IS NOT NULL) ON VIOLATION DROP ROW,
CONSTRAINT valid_amount EXPECT (amount > 0) ON VIOLATION DROP ROW,
-- no ON VIOLATION clause: warn only, keep the row
CONSTRAINT known_status EXPECT (status IN ('NEW', 'PAID', 'SHIPPED', 'CANCELLED'))
) AS SELECT CAST(order_id AS BIGINT) order_id, customer_id,
CAST(amount AS DECIMAL(12,2)) amount, upper(status) status,
CAST(order_ts AS TIMESTAMP) order_ts
FROM STREAM(bronze.orders);
-- gold: materialized view, refreshed incrementally where possible
CREATE OR REFRESH MATERIALIZED VIEW gold.daily_revenue
AS SELECT date(order_ts) AS order_date, SUM(amount) AS revenue, COUNT(*) AS orders
FROM silver.orders WHERE status <> 'CANCELLED'
GROUP BY ALL;
Lakeflow pipeline SQL: follows the Databricks documentation but needs a Databricks workspace, so it was not executed here.
| Object | Behaviour | Use for |
|---|---|---|
| Streaming table | Processes each input row once, incrementally | Ingestion, append-mostly transforms, CDC targets |
| Materialized view | Result kept up to date; recomputed incrementally where possible | Aggregations, joins, gold tables |
| Expectation: warn / DROP ROW / FAIL UPDATE | Records metrics, drops bad rows, or stops the update | Data quality enforced in the pipeline |
5. Advanced Ingestion and Streaming
Auto Loader with schema evolution and a rescue column
(spark.readStream.format("cloudFiles")
.option("cloudFiles.format", "json")
.option("cloudFiles.schemaLocation", "/Volumes/prod_sales/bronze/_schemas/orders")
# new columns: the stream stops once, then continues with the new schema
.option("cloudFiles.schemaEvolutionMode", "addNewColumns")
.option("cloudFiles.inferColumnTypes", "true")
.load("/Volumes/prod_sales/bronze/landing/orders/") # odd values -> _rescued_data
.writeStream
.option("checkpointLocation", "/Volumes/prod_sales/bronze/_chk/orders")
.trigger(availableNow=True) # incremental batch: process new files, then stop
.toTable("prod_sales.bronze.orders"))
Upserting a stream with foreachBatch
def upsert(batch_df, batch_id):
latest = (batch_df.withColumn("rn", F.row_number().over(
Window.partitionBy("order_id").orderBy(F.col("updated_at").desc())))
.filter("rn = 1").drop("rn")) # one row per key per batch
latest.createOrReplaceTempView("batch")
batch_df.sparkSession.sql("""
MERGE INTO prod_sales.silver.orders t USING batch s ON t.order_id = s.order_id
WHEN MATCHED AND s.updated_at > t.updated_at THEN UPDATE SET *
WHEN NOT MATCHED THEN INSERT *""")
(spark.readStream.table("prod_sales.bronze.orders")
.writeStream.foreachBatch(upsert)
.option("checkpointLocation", "/Volumes/prod_sales/silver/_chk/orders")
.trigger(processingTime="1 minute")
.start())
Auto Loader and streaming code: follows the Databricks documentation but needs a Databricks workspace, so it was not executed here.
| Topic | Advanced point |
|---|---|
| Triggers | availableNow for incremental batch; processingTime for continuous micro-batches; real-time mode for lowest latency |
| State store | Use the RocksDB state store for large stateful queries (aggregations, dedup, stream-stream joins) |
| Watermarks | Bound state: withWatermark("event_time", "30 minutes") before windowed aggregations and dropDuplicates |
| Exactly-once | Checkpoint + Delta sink = exactly-once results; foreachBatch must be idempotent (MERGE, or txnAppId/txnVersion) |
| Change Data Feed | readChangeFeed on a Delta table streams row-level inserts, updates and deletes downstream |
| Kafka / Kinesis | Native connectors; keep raw payloads in bronze, parse into typed silver |
6. Performance and Layout
| Technique | What it does | How |
|---|---|---|
| Liquid clustering | Clusters data by keys incrementally; keys can change | CREATE TABLE ... CLUSTER BY (customer_id, order_date) or CLUSTER BY AUTO |
| Photon | Vectorised C++ engine for SQL and DataFrames | On by default for SQL warehouses and serverless; enable on job clusters |
| Predictive Optimization | Automatic OPTIMIZE, VACUUM, ANALYZE for UC managed tables | ALTER CATALOG prod ENABLE PREDICTIVE OPTIMIZATION |
| Deletion vectors | Deletes and updates without rewriting whole files | Default for new tables; purge with REORG ... APPLY (PURGE) |
| Data skipping | Min/max stats per file skip irrelevant data | Put filter columns among the first 32 columns, or set delta.dataSkippingStatsColumns |
| Adaptive Query Execution | Re-optimises joins and partitions at runtime | On by default; handles skew and coalesces small partitions |
| Broadcast joins | Avoids shuffling the big side | F.broadcast(dim) for small dimensions |
| Disk cache | Caches remote files on local SSDs | Automatic on supported instance types |
| Partitioning | Only for very large tables with low-cardinality keys (e.g. date) | Prefer liquid clustering for new tables |
CREATE TABLE prod_sales.silver.orders ( order_id BIGINT GENERATED ALWAYS AS IDENTITY, customer_id STRING, order_date DATE, amount DECIMAL(12,2), status STRING, CONSTRAINT positive_amount CHECK (amount > 0) ) CLUSTER BY (customer_id, order_date); OPTIMIZE prod_sales.silver.orders; -- clusters new data incrementally ANALYZE TABLE prod_sales.silver.orders COMPUTE STATISTICS FOR ALL COLUMNS;
Databricks table DDL: follows the Databricks documentation but needs a Databricks workspace, so it was not executed here.
Maintenance (OPTIMIZE, VACUUM, Predictive Optimization) is covered in detail in section 33 of the Spark & Databricks guide.
7. Jobs, Asset Bundles and CI/CD
Databricks Asset Bundles describe jobs, pipelines and their settings as YAML in Git, so the same project deploys to dev, test and prod with one command.
# databricks.yml
bundle:
name: sales_pipeline
targets:
dev:
mode: development
workspace: { host: https://dev-workspace.cloud.databricks.com }
prod:
mode: production
workspace: { host: https://prod-workspace.cloud.databricks.com }
run_as: { service_principal_name: sales-platform-sp }
resources:
jobs:
daily_sales:
name: daily_sales
schedule: { quartz_cron_expression: "0 0 2 * * ?", timezone_id: Asia/Kolkata }
tasks:
- task_key: ingest
notebook_task: { notebook_path: ./src/ingest.py }
- task_key: scd2_customers
depends_on: [{ task_key: ingest }]
notebook_task: { notebook_path: ./src/scd2_customers.py }
max_retries: 2
email_notifications: { on_failure: [data-oncall@example.com] }
databricks bundle validate databricks bundle deploy --target prod databricks bundle run daily_sales --target prod
Asset Bundle configuration: follows the Databricks documentation but needs a Databricks workspace, so it was not executed here.
| Practice | Why |
|---|---|
| Run production as a service principal | Jobs do not break when people leave; least privilege |
| Job clusters or serverless, not all-purpose clusters | Cheaper, isolated, reproducible |
| Cluster policies | Limit instance types, enforce tags and auto-termination |
| Secrets in secret scopes or UC connections | No credentials in notebooks or Git |
| Repair runs | Re-run only failed tasks of a job |
8. Sharing, Federation and AI
| Feature | What it does | Example |
|---|---|---|
| Delta Sharing | Share live tables with other organisations or platforms without copying | CREATE SHARE partner_share; ALTER SHARE partner_share ADD TABLE prod_sales.gold.daily_revenue; |
| Lakehouse Federation | Query external databases (PostgreSQL, SQL Server, Snowflake, BigQuery…) through UC | CREATE FOREIGN CATALOG pg USING CONNECTION pg_conn OPTIONS (database 'crm'); |
| UniForm | Delta tables readable as Iceberg by other engines | TBLPROPERTIES ('delta.universalFormat.enabledFormats' = 'iceberg') |
| Mosaic AI Vector Search | Vector index kept in sync with a Delta table | RAG over governed data |
| Model Serving | Serve ML models and foundation models behind endpoints | Real-time scoring, LLM endpoints |
| MLflow | Experiment tracking, model registry in UC | mlflow.register_model(..., "prod_ml.models.churn") |
| AI Functions | Call models from SQL | SELECT ai_query('endpoint', text) FROM reviews |
Sharing and federation examples: follows the Databricks documentation but needs a Databricks workspace, so it was not executed here.
9. Advanced Topics Study Map
Examples are short illustrations for learning; they follow Databricks syntax but were not executed. Replace table and path names with your own.
1. Advanced Delta Lake
| Topic | What it is and why it matters | Example | Priority |
|---|---|---|---|
| Transaction log | Every write adds a JSON commit file to _delta_log; every 10 commits a Parquet checkpoint summarises the table state. Readers replay the latest checkpoint plus newer commits, which is how Delta gives ACID and time travel on plain files. | DESCRIBE HISTORY sales.orders;Files: …010.checkpoint.parquet, …011.json | High |
| Optimistic concurrency | Writers read a snapshot, write new files, then try to commit; if another commit touched the same files first, the later writer fails with a conflict and retries. Blind appends almost never conflict; concurrent MERGE/UPDATE on the same data can. | Two jobs MERGE into the same date → one fails with ConcurrentAppendException. Fix: make them touch different files, or run them one after another | High |
| Change Data Feed | When enabled, Delta records row-level changes (insert, update_preimage, update_postimage, delete) per version. Downstream jobs read only what changed instead of rescanning the table. | ALTER TABLE silver.orders SET TBLPROPERTIES (delta.enableChangeDataFeed = true);SELECT * FROM table_changes('silver.orders', 12); | High |
| Deletion vectors | DELETE/UPDATE/MERGE mark rows as removed in a small side file instead of rewriting the whole Parquet file, making writes much faster. The old bytes stay until files are rewritten, which matters for GDPR erasure. | ALTER TABLE t SET TBLPROPERTIES ('delta.enableDeletionVectors' = true);REORG TABLE t APPLY (PURGE); | High |
| Liquid clustering | Co-locates rows with similar key values so data skipping works, without fixed folder partitions. Clustering is incremental (only new data is clustered) and keys can be changed later without rewriting history. | CREATE TABLE gold.sales (...) CLUSTER BY (customer_id, sale_date);ALTER TABLE gold.sales CLUSTER BY (region); | High |
| Automatic liquid clustering | Databricks watches query filters and chooses or changes clustering keys for you. It requires Unity Catalog managed tables with Predictive Optimization. | ALTER TABLE gold.sales CLUSTER BY AUTO; | High |
| Predictive Optimization | Databricks decides when tables need OPTIMIZE, VACUUM and statistics, and runs them on serverless compute. Removes the need to schedule maintenance jobs for managed tables. | ALTER CATALOG prod ENABLE PREDICTIVE OPTIMIZATION; | High |
| UniForm | Writes Iceberg metadata alongside Delta metadata, so Iceberg engines (Snowflake, Trino, Athena) read the same files. One copy of data, two formats. | ALTER TABLE gold.sales SET TBLPROPERTIES ('delta.universalFormat.enabledFormats' = 'iceberg'); | Medium |
| Column mapping | Maps logical column names to physical IDs, so renaming or dropping a column is a metadata change instead of a full rewrite. Also allows spaces and special characters in names. | ALTER TABLE t SET TBLPROPERTIES ('delta.columnMapping.mode' = 'name');ALTER TABLE t RENAME COLUMN cust TO customer_id; | Medium |
| Schema evolution | Additive changes (new columns) can be merged automatically; type changes and renames need deliberate handling. Allow evolution in bronze, control it in silver and gold so bad source changes do not reach reports. | df.write.option("mergeSchema", "true").mode("append").saveAsTable("bronze.orders") | High |
| Time travel + RESTORE | Query any retained version by number or timestamp, and roll a table back after a bad load. History is limited by VACUUM retention (7 days by default). | SELECT * FROM orders TIMESTAMP AS OF '2026-11-30';RESTORE TABLE orders TO VERSION AS OF 42; | High |
| Shallow vs deep clone | A shallow clone copies only metadata and points to the source files (instant, cheap, good for testing). A deep clone copies the data too, so it is independent (backups, DR, migrations). | CREATE TABLE dev.orders SHALLOW CLONE prod.orders;CREATE TABLE dr.orders DEEP CLONE prod.orders; | Medium |
| Managed vs external tables | Managed tables store data in UC-managed storage; Databricks controls layout and deletes files on DROP. External tables point at your own path; DROP removes only metadata. Managed is the recommended default. | CREATE TABLE s.t (id INT); (managed)CREATE TABLE s.t (id INT) LOCATION 's3://bucket/t'; (external) | High |
| Table features / protocol (added) | Features such as deletion vectors or column mapping raise the table's reader/writer protocol. Older Spark or external readers may then fail to read it, so check consumers before enabling. | DESCRIBE DETAIL t; → minReaderVersion, tableFeatures | Medium |
| Row tracking (added) | Gives every row a stable ID and commit version, which lets materialized views and change tracking work incrementally. | ALTER TABLE t SET TBLPROPERTIES ('delta.enableRowTracking' = true); | Low |
2. Spark and Performance
| Topic | What it is and why it matters | Example | Priority |
|---|---|---|---|
| Photon | A native C++ vectorised engine that runs Spark SQL and DataFrame operations much faster, especially scans, joins and aggregations. On by default for SQL warehouses and serverless; enable it on job clusters. | Job cluster setting: "runtime_engine": "PHOTON" | High |
| Catalyst optimizer | Turns your query into a logical plan, optimises it (predicate pushdown, column pruning, join reordering), then picks a physical plan. Reading the plan explains most performance surprises. | df.explain("formatted") | High |
| Adaptive Query Execution | Re-plans at runtime using real shuffle statistics: switches to broadcast joins, coalesces small partitions and splits skewed ones. On by default since Spark 3.2. | spark.conf.get("spark.sql.adaptive.enabled") → true | High |
| Dynamic file pruning | When a fact table is joined to a filtered dimension, Databricks uses the dimension's join keys at runtime to skip fact files that cannot match. | ... FROM fact f JOIN dim_date d ON f.date_key = d.date_key WHERE d.year = 2026 | Medium |
| Data skipping | Delta stores min/max statistics per file for the first 32 columns; filters on those columns skip whole files. Put filter columns early or choose them explicitly. | ALTER TABLE t SET TBLPROPERTIES ('delta.dataSkippingStatsColumns' = 'order_date,customer_id'); | High |
| Predictive I/O | Photon features that speed up selective reads and make updates and deletes cheaper (using deletion vectors). Mostly automatic on supported compute. | Point lookups like WHERE order_id = 123 on large tables run faster without extra indexes | Medium |
| Join strategies | Broadcast hash join ships a small table to every executor (no shuffle); sort-merge join shuffles and sorts both large sides; shuffle hash join hashes one side. Broadcasting small dimensions is the biggest easy win. | fact.join(F.broadcast(dim_store), "store_id") | High |
| Skew handling | A few huge keys make one task run for hours. AQE splits skewed partitions automatically; for extreme cases add a random salt to the hot key and replicate the other side. | df.withColumn("salt", (F.rand() * 16).cast("int")) then join on [key, salt] | High |
| Memory management | Executor memory is shared between execution (joins, sorts) and storage (cache). When it runs out, Spark spills to disk, which is slow; spill usually means too few partitions or too little memory. | Spark UI → stage → "Spill (disk)"; fix with more partitions or larger workers | Medium |
| Spark UI | Jobs → stages → tasks shows where time goes. Look for one slow task (skew), large shuffle read/write, spill and GC time. | Stage with max task 40 min vs median 20 s → skewed key | High |
| Query Profile | The Databricks SQL view of an executed query: time and rows per operator, files read vs pruned, spill. The first place to look for slow SQL. | SQL editor → Query history → query → "See query profile" | Medium |
| Compute sizing | Start from data scanned and shuffle size: aim for 128–256 MB per task and enough cores to run tasks in a few waves. Use memory-optimised workers for big joins and caching. | 1 TB scan / 200 MB per task ≈ 5,000 tasks; with 160 cores ≈ 31 waves; double the cores to roughly halve the time | High |
| Disk caching | Copies remote Parquet/Delta files to local SSDs on first read, so repeated reads are fast. Automatic on suitable instance types; different from df.cache(). | spark.conf.set("spark.databricks.io.cache.enabled", "true") | Low |
| Small files | Thousands of tiny files slow every query. Prevent them with optimized writes and auto compaction, then compact with OPTIMIZE or Predictive Optimization. | ALTER TABLE t SET TBLPROPERTIES ('delta.autoOptimize.optimizeWrite' = true, 'delta.autoOptimize.autoCompact' = true); | High |
3. Ingestion and Streaming
| Topic | What it is and why it matters | Example | Priority |
|---|---|---|---|
| Auto Loader internals | Auto Loader (cloudFiles) remembers which files it has processed in its checkpoint, so each file loads once, even across restarts. It infers and tracks the schema in schemaLocation. | spark.readStream.format("cloudFiles").option("cloudFiles.format", "json") | High |
| File notification mode | Instead of listing huge folders every run, Auto Loader subscribes to cloud storage events (SQS/SNS, Event Grid). Faster and cheaper when millions of files exist. | .option("cloudFiles.useNotifications", "true") | Medium |
| Rescued data column | Values that do not match the schema (wrong type, unexpected field) go into _rescued_data as JSON instead of failing the stream or being lost. | SELECT _rescued_data FROM bronze.orders WHERE _rescued_data IS NOT NULL | High |
| Structured Streaming | Treats a stream as an unbounded table processed in micro-batches. The checkpoint stores offsets and state, so a restarted query continues exactly where it stopped. | .writeStream.option("checkpointLocation", "/Volumes/c/s/v/_chk/orders").toTable("silver.orders") | High |
| Watermarking | Tells Spark how late events may arrive; older state is dropped and later events are ignored. Without it, windowed aggregations and dedup keep state forever. | df.withWatermark("event_time", "30 minutes").groupBy(F.window("event_time", "5 minutes")).count() | High |
| Stateful processing | Aggregations, dedup and custom logic keep state between micro-batches. transformWithState (Spark 4) gives full control: timers, TTL, multiple state variables. | df.dropDuplicatesWithinWatermark(["event_id"]) | Medium |
| Stream-stream joins | Joining two streams (e.g. ad impressions and clicks) needs watermarks on both and a time-range condition, so Spark knows when unmatched rows can be dropped. | imp.join(clk, F.expr("clk.ad_id = imp.ad_id AND clk.ts BETWEEN imp.ts AND imp.ts + INTERVAL 1 HOUR")) | Medium |
| Stream-static joins | Enrich each event with a Delta dimension table. The static side is re-read every micro-batch, so dimension updates are picked up automatically. | events.join(spark.table("gold.dim_store"), "store_id") | High |
| RocksDB state store | Stores streaming state in RocksDB on local disk instead of JVM memory, so large state (millions of keys) does not cause garbage-collection pauses or out-of-memory errors. | Spark config: set stateStore.providerClass to the RocksDB provider (on by default in many recent runtimes) | Medium |
| Exactly-once | Achieved by combining replayable sources, checkpoints, and a sink that commits atomically (Delta) or writes idempotently. Duplicates appear when foreachBatch writes are not idempotent. | Kafka → checkpoint → Delta table: a crash mid-batch re-runs the batch without duplicate rows | High |
| foreachBatch | Runs batch code on each micro-batch, typically a MERGE into a Delta table or writes to several sinks. Must be idempotent because a batch can be retried. | .writeStream.foreachBatch(lambda df, batch_id: upsert(df, batch_id)) | High |
| Lakeflow Connect | Managed ingestion connectors (Salesforce, Workday, SQL Server and more) with built-in CDC, landing data straight into UC tables without custom code. | Create an ingestion pipeline in the UI: source = SQL Server, target = bronze schema | Medium |
| CDC sequencing | CDC events can arrive out of order or duplicated. Order by a sequence number (LSN, timestamp), keep the latest per key, and apply deletes explicitly. | ROW_NUMBER() OVER (PARTITION BY id ORDER BY lsn DESC) = 1 or SEQUENCE BY lsn in AUTO CDC | High |
4. Lakeflow Declarative Pipelines (formerly DLT)
| Topic | What it is and why it matters | Example | Priority |
|---|---|---|---|
| Declarative pipelines | You declare tables as queries; the engine builds the dependency graph, runs them in order, retries, scales compute and tracks lineage. Less orchestration code to maintain. | CREATE OR REFRESH STREAMING TABLE silver.orders AS SELECT ... FROM STREAM(bronze.orders); | High |
| Streaming tables | Append-style tables that process each new input row once. Ideal for ingestion and as targets of AUTO CDC. | CREATE OR REFRESH STREAMING TABLE bronze.orders AS SELECT * FROM STREAM read_files('/Volumes/c/s/landing/'); | High |
| Materialized views | Store the result of a query and keep it current; Databricks refreshes incrementally when possible, otherwise fully. Ideal for gold aggregates. | CREATE OR REFRESH MATERIALIZED VIEW gold.daily_sales AS SELECT order_date, SUM(amount) FROM silver.orders GROUP BY ALL; | High |
| AUTO CDC | Applies a CDC feed to a target: upserts by key, applies deletes, and orders events by a sequence column so late or duplicate events are handled. Formerly APPLY CHANGES INTO. | AUTO CDC INTO silver.customers FROM STREAM(bronze.cdc) KEYS (id) SEQUENCE BY lsn | High |
| AUTO CDC FROM SNAPSHOT | For sources that only give full snapshots (no change log): the pipeline compares each snapshot with the previous one and derives inserts, updates and deletes. | dp.create_auto_cdc_from_snapshot_flow(target="silver.products", source="bronze.products_snapshot", keys=["product_id"]) | Medium |
| SCD Type 1 | Keeps only the latest version of each key, overwriting changes. Use for attributes where history does not matter (corrections, contact details). | ... STORED AS SCD TYPE 1; | High |
| SCD Type 2 | Keeps full history: each change closes the old row and adds a new one with __START_AT / __END_AT. Can track history on selected columns only. | ... STORED AS SCD TYPE 2 TRACK HISTORY ON (city, segment); | High |
| Expectations | Data quality rules on a table: warn (keep row, record metric), DROP ROW, or FAIL UPDATE. Results appear in the pipeline UI and event log. | CONSTRAINT valid_amount EXPECT (amount > 0) ON VIOLATION DROP ROW | High |
| Quarantine pattern | Instead of silently dropping bad rows, write them to a separate table with the reason, so they can be fixed and replayed. | Two tables from one source: WHERE is_valid → silver, WHERE NOT is_valid → quarantine | High |
| Event log | A Delta table recording every pipeline update: flows, row counts, expectation pass/fail, errors and lineage. Query it for monitoring and alerting. | SELECT * FROM event_log(TABLE(silver.orders)) WHERE event_type = 'flow_progress'; | Medium |
| Incremental refresh | Materialized views recompute only changed data when the query shape allows (aggregations, supported joins); otherwise they fall back to a full recompute. | Check the event log planning_information event to see whether a refresh was incremental | Medium |
5. Unity Catalog and Governance
| Topic | What it is and why it matters | Example | Priority |
|---|---|---|---|
| UC architecture | One metastore per region holds catalogs → schemas → tables, views, volumes, functions and models. Permissions, lineage and audit work the same across every workspace attached to it. | Name every object fully: prod_sales.gold.fact_orders | High |
| Storage credentials | Wrap a cloud identity (AWS IAM role, Azure managed identity) so Databricks can reach storage without keys in notebooks. Admins create them once. | Catalog Explorer → External data → Credentials → AWS IAM role ARN | High |
| External locations | Bind a storage credential to a path, then grant READ FILES / CREATE EXTERNAL TABLE on it. All access to that path is governed and audited. | CREATE EXTERNAL LOCATION landing URL 's3://acme-landing/' WITH (STORAGE CREDENTIAL acme_role); | High |
| Volumes | Governed storage for files (CSV, images, PDFs, model files) with the same permissions as tables. Replace DBFS mounts. | CREATE VOLUME prod_sales.bronze.landing; → /Volumes/prod_sales/bronze/landing/ | High |
| Workspace bindings | Restrict a catalog to chosen workspaces, e.g. production data visible only from the prod workspace, even to users with grants. | Catalog → Workspaces tab → bind prod_sales to the prod workspace only | High |
| Row filters | A SQL function attached to a table that returns TRUE for rows the user may see. Applies in every tool and engine reading through UC. | ALTER TABLE t SET ROW FILTER region_filter ON (region); | High |
| Column masks | A SQL function that returns the value a user may see, e.g. full email for privileged groups, masked for everyone else. | ALTER TABLE t ALTER COLUMN email SET MASK mask_email; | High |
| ABAC | Attribute-based policies attach to governed tags rather than to tables, so any new table tagged pii is protected automatically. Scales to thousands of tables. | Policy: mask columns tagged pii=email unless the user is in pii-readers | High |
| Governed tags | Tags with a controlled list of allowed values and permissions on who can assign them, so classifications are consistent and trustworthy. | ALTER TABLE t ALTER COLUMN email SET TAGS ('pii' = 'email'); | High |
| Column-level lineage | UC records which source columns feed each target column for queries run on Databricks. Used for impact analysis and audits. | SELECT * FROM system.access.column_lineage WHERE target_table_full_name = 'prod.gold.revenue'; | High |
| System tables | Databricks-managed tables in the system catalog for audit logs, lineage, billing, compute and query history. The basis of monitoring and FinOps. | SELECT sku_name, SUM(usage_quantity) FROM system.billing.usage GROUP BY ALL; | High |
| Data classification | Scans UC tables to detect likely PII (emails, phone numbers, IDs) and suggests tags for review. | Review suggested classifications in Catalog Explorer, then apply governed tags | Medium |
| Delta Sharing | Open protocol to share live tables with other organisations or platforms (even non-Databricks) without copying data. | CREATE SHARE partner; ALTER SHARE partner ADD TABLE prod.gold.daily_sales; | Medium |
| Lakehouse Federation | Query external databases (PostgreSQL, SQL Server, Snowflake, BigQuery) through UC with the same permissions, without building ingestion first. | CREATE FOREIGN CATALOG crm USING CONNECTION pg_conn OPTIONS (database 'crm'); | Medium |
| Service principals | Non-human identities that own and run jobs and CI/CD. Jobs keep working when people leave, and permissions stay least-privilege. | Bundle setting: run_as: { service_principal_name: etl-sp } | High |
6. Compute and Infrastructure
| Topic | What it is and why it matters | Example | Priority |
|---|---|---|---|
| Classic compute | Clusters run as VMs in your cloud account; you choose instance types and pay both Databricks DBUs and the cloud bill. Needed for custom networking or libraries not supported on serverless. | Job cluster: node_type_id: "r6i.2xlarge", num_workers: 8 | High |
| Serverless compute | Databricks manages the machines; compute starts in seconds and scales automatically. Less tuning, and often cheaper for spiky or short workloads. | Notebook or job compute selector → "Serverless" | High |
| Job compute | A cluster created for one job run and terminated afterwards. Cheaper DBU rate and isolated from other workloads compared with all-purpose clusters. | Production jobs: job clusters or serverless, never a shared all-purpose cluster | High |
| SQL warehouses | Compute dedicated to SQL and BI, with Photon, caching and concurrency scaling. Serverless warehouses start fast and stop when idle. | Power BI connects to a serverless SQL warehouse with auto-stop after 10 minutes | High |
| Standard vs dedicated access mode | Standard (formerly shared) isolates multiple users on one cluster with UC enforcement; dedicated (formerly single user) is assigned to one user or group and supports more features, such as some ML runtimes. | Team notebooks → standard; GPU ML training → dedicated | High |
| Compute policies | Rules that limit what users can create: instance types, maximum workers, mandatory tags, auto-termination. The main cost and governance control for classic compute. | "autotermination_minutes": {"type": "range", "maxValue": 60} | High |
| Autoscaling | Adds workers when tasks queue and removes them when idle. Set min and max sensibly; streaming in declarative pipelines uses enhanced autoscaling. | "autoscale": {"min_workers": 2, "max_workers": 10} | Medium |
| Instance pools | Keep idle, pre-started VMs so clusters start in seconds instead of minutes. Useful for frequent short jobs on classic compute. | Pool with min_idle_instances: 2 shared by many job clusters | Low |
| Spot instances | Use cheap spare cloud capacity for workers; keep the driver on-demand so a reclaim does not kill the job. Spark recomputes lost tasks. | "aws_attributes": {"first_on_demand": 1, "availability": "SPOT_WITH_FALLBACK"} | Medium |
| Control vs compute plane | The control plane (Databricks account) hosts the UI, jobs and metadata; the compute plane runs data processing in your cloud account or in serverless. Data stays in your storage. | Security review: "where does our data go?" → processed on classic or serverless compute, stored in your storage | High |
| PrivateLink | Private network paths from users and clusters to the Databricks control plane, so traffic never crosses the public internet. | Front-end PrivateLink for users, back-end PrivateLink for clusters | Medium |
| Customer-managed VPC | Deploy workspace compute into your own VPC/VNet to control subnets, routing, firewalls and egress. | Workspace created with your VPC ID and private subnets | Medium |
| Customer-managed keys | Encrypt managed services and workspace storage with your own KMS keys, which you can rotate or revoke. | KMS key ARN configured for managed storage at workspace setup | Medium |
| Disaster recovery | Keep a secondary-region workspace ready via IaC, replicate data with deep clone or storage replication, and re-point jobs on failover. Define RPO and RTO per data tier. | Nightly DEEP CLONE of gold tables to the DR region + Terraform to rebuild jobs | Medium |
7. Data Modelling and Analytics
| Topic | What it is and why it matters | Example | Priority |
|---|---|---|---|
| Medallion architecture | Bronze keeps raw data for replay, silver holds cleaned and conformed entities, gold holds business-ready models. Each layer has a clear contract and owner. | bronze.orders_raw → silver.orders → gold.fact_sales | High |
| Data Vault 2.0 | Hubs (business keys), links (relationships) and satellites (history) integrate many changing sources with full audit. Gold star schemas are built on top for users. | hub_customer, link_customer_account, sat_customer_details | Medium |
| Dimensional modelling | Facts at a declared grain plus descriptive dimensions (a star schema) give fast, understandable analytics. Always write the grain down. | Grain: "one row per order line" for fact_sales | High |
| Conformed dimensions | The same customer, product and date dimensions reused by every fact, so numbers from different processes can be compared. | dim_customer shared by sales, returns and support facts | High |
| Fact-to-fact joins | Joining two facts on a shared dimension multiplies rows (fan-out) and double counts. Aggregate each fact to the same grain first, then join (drill-across). | WITH s AS (SELECT cust, SUM(amt) AS sales ...), r AS (...) SELECT ... FROM s FULL JOIN r USING (cust) | High |
| Metric views | Business metrics (revenue, margin) defined once in Unity Catalog and reused by dashboards, Genie and SQL, so everyone gets the same number. | Metric view sales_metrics with measure revenue = SUM(amount) | Medium |
| Semantic layer | A shared layer of business definitions over the data model, so "active customer" means the same in every tool. | Revenue defined once, used by Power BI and Genie | Medium |
| Materialized views | Precomputed gold datasets refreshed automatically; good for heavy aggregations read by many dashboards. | CREATE MATERIALIZED VIEW gold.mv_sales_by_month AS SELECT ... | Medium |
| AI/BI dashboards | Native Databricks dashboards on SQL warehouses, governed by UC permissions. | Dashboard on gold.fact_sales shared with sales leadership | Low |
| AI/BI Genie | Natural-language questions over a curated set of tables; works best with good table comments, metric views and example queries. | "What was revenue by region last quarter?" → generated SQL + chart | Medium |
| Data mesh | Domains own and publish their data as products on a shared self-serve platform with federated governance. | Sales domain owns the sales catalog; the platform team owns UC, compute policies and CI/CD | Medium |
| Data products | Datasets with an owner, documentation, quality checks, SLAs and access rules, designed for reuse. | gold.customer_360 with an owner, a 07:00 freshness SLA and DQ checks | Medium |
8. DevOps and Production
| Topic | What it is and why it matters | Example | Priority |
|---|---|---|---|
| Asset Bundles | Describe jobs, pipelines, permissions and settings as YAML in Git, then validate and deploy the same project to dev, test and prod targets. | databricks bundle deploy --target prod | High |
| Databricks CLI | Command-line access to workspaces, jobs, UC and bundles; the basis of scripts and CI pipelines. | databricks jobs run-now 123 | Medium |
| Databricks SDK | Python, Java and Go libraries for automating the platform: create jobs, manage permissions, query system tables. | from databricks.sdk import WorkspaceClient; w = WorkspaceClient(); w.jobs.list() | Medium |
| REST API | The HTTP API behind the CLI and SDK; used by external schedulers and tools. | POST /api/2.2/jobs/run-now {"job_id": 123} | Low |
| Terraform | Infrastructure as code for workspaces, UC objects, permissions and cluster policies; common for platform teams. | resource "databricks_catalog" "sales" { name = "prod_sales" } | High |
| Git folders | Connect a workspace folder to a Git repository so notebooks and code are versioned, reviewed and branched. | Workspace → Git folder → clone github.com/acme/sales-pipeline | High |
| CI/CD | On every pull request: lint, unit tests, bundle validate. On merge: deploy to test, run integration tests, then promote to prod. | GitHub Actions: pytest → databricks bundle deploy -t test | High |
| Lakeflow Jobs | Production orchestration: tasks with dependencies, retries, schedules or file-arrival triggers, alerts and repair runs. Formerly Workflows. | Job: ingest → transform → quality check → refresh dashboard | High |
| Task values | Pass small values (counts, dates, flags) from one task to downstream tasks. | dbutils.jobs.taskValues.set(key="rows", value=1200) | Medium |
| Job parameters | One job definition reused for many sources or dates by passing parameters at run time. | Run with run_date = 2026-12-01; tasks read it as {{job.parameters.run_date}} | High |
| For each task | Runs a nested task once per item in a list, in parallel, e.g. one load per source table. | Input ["orders", "customers", "products"] → 3 parallel ingest runs | Medium |
| Repair runs | Re-run only the failed tasks (and their downstream tasks) of a job run, keeping successful results. | Job run page → "Repair run" | Medium |
| Unit + integration tests | Unit-test pure transformation functions with pytest and a local SparkSession; integration-test the pipeline on sample data in a test workspace. | def test_clean(spark): assert clean(sample_df).count() == 3 | High |
| Environment promotion | The same code and bundle deployed to separate dev, UAT and prod targets, each with its own catalog (e.g. dev_sales, prod_sales) and service principal. | databricks bundle deploy -t uat && databricks bundle deploy -t prod | High |
Naming check: the deployment tool is documented as Databricks Asset Bundles; if you see another name, confirm it against the current Databricks docs before quoting it in an interview.
9. AI and Generative AI
| Topic | What it is and why it matters | Example | Priority |
|---|---|---|---|
| Mosaic AI | Databricks' umbrella for building, serving, evaluating and governing AI, all on Unity Catalog data and permissions. | RAG app: Vector Search + Model Serving + MLflow evaluation | Medium |
| Vector Search | A vector index that stays in sync with a Delta table: new or changed rows are embedded and indexed automatically. Used for semantic search and RAG. | index.similarity_search(query_text="refund policy", columns=["chunk"], num_results=5) | High |
| Feature Store | Feature tables in UC reused across models, with point-in-time joins for training and online serving for low-latency inference. | FeatureLookup(table_name="ml.customer_features", lookup_key="customer_id") | Medium |
| MLflow | Tracks experiments, registers models in UC, evaluates models and LLM apps, and traces agent calls. | mlflow.register_model("runs:/<run_id>/model", "prod_ml.models.churn") | High |
| Model Serving | Deploys ML models and foundation models as scalable REST endpoints with autoscaling and monitoring. | POST /serving-endpoints/churn/invocations {"dataframe_records": [...]} | Medium |
| Agent Framework | Tools to build agents that call functions and query enterprise data, evaluate them with judges, and deploy them with review apps. | Agent with a UC function tool get_order_status(order_id) | Medium |
| AI Gateway | Central controls on model endpoints: rate limits, usage tracking, payload logging and guardrails. | Limit an endpoint to 100 requests per minute per user; log requests to a UC table | Medium |
| AI Functions (added) | Call models directly from SQL for classification, extraction, summarisation and translation at scale. | SELECT ai_classify(review, ARRAY('positive', 'negative')) FROM reviews; | Medium |
10. Enterprise Architecture and Cost
| Topic | What it is and why it matters | Example | Priority |
|---|---|---|---|
| Metadata-driven framework | A config table lists sources, targets, load types and keys; one generic, tested pipeline reads it. Adding a source becomes a config row, not new code. | INSERT INTO ctl.ingest_config VALUES ('crm', 'customers', 'incremental', 'customer_id', 'updated_at'); | High |
| Multi-workspace design | Separate workspaces per environment (and sometimes per domain) for isolation, all attached to one regional metastore with workspace bindings. | dev, uat, prod workspaces; prod catalogs bound to prod only | High |
| Multi-account cloud setup | Separate cloud accounts for prod, non-prod, security and logging limit the blast radius and simplify compliance. | AWS Organizations: data-prod, data-dev, security, log-archive | Medium |
| Data observability | Monitor freshness, volume, schema and distribution changes on key tables and alert owners before users notice. | Alert if gold.fact_sales is not updated by 07:00 or its row count drops 30% | High |
| Reconciliation | Compare source and target with counts, sums and row hashes; counts alone can hide wrong values. | SELECT COUNT(*), SUM(amount), SUM(xxhash64(*)) FROM t | High |
| Disaster recovery | Agree RPO and RTO per data tier, replicate critical tables to another region, and keep jobs and permissions in IaC so they can be rebuilt. | Tier 1 gold: deep clone hourly to DR; sandbox: no DR | High |
| Cost attribution | Tag compute by team or project and query system.billing.usage to charge back DBU cost. | SELECT custom_tags['team'], SUM(usage_quantity) FROM system.billing.usage GROUP BY 1; | High |
| FinOps | Budgets, compute policies, serverless where it is cheaper, auto-termination and regular reviews of the biggest jobs. | Monthly review: top 10 jobs by DBUs, idle clusters, oversized warehouses | High |
| Workload isolation | Separate compute for ETL, streaming and BI, so a heavy batch never slows dashboards. | Streaming on its own job cluster; BI on a dedicated SQL warehouse | High |
| Regulatory compliance | BCBS 239, GDPR/DPDP and PCI DSS require lineage, masking, audit logs, retention and erasure procedures you can evidence. | Audit query: who read PII tables last month (system.access.audit) | High |
| Data contracts | Producers and consumers agree schema, meaning, quality rules and freshness SLAs; breaking changes need notice and versioning. | Contract YAML in Git, checked in CI before a schema change merges | High |
| Historical backfill | Reprocess a date range into the same tables with an idempotent MERGE, in chunks, without touching the live pipeline. | Job parameters start_date=2025-01-01, end_date=2025-12-31, looped per month | High |
| Data retention | Retention per table (log and file retention, archival tiers) plus deletion procedures for erasure requests. | ALTER TABLE t SET TBLPROPERTIES ('delta.deletedFileRetentionDuration' = 'interval 30 days'); | High |
10. Quick Reference
Unity Catalog commands
| Task | Command |
|---|---|
| Create catalog / schema | CREATE CATALOG c; · CREATE SCHEMA c.s; |
| Grant read on a schema | GRANT USE CATALOG ON CATALOG c TO `g`; GRANT USE SCHEMA, SELECT ON SCHEMA c.s TO `g`; |
| Show grants | SHOW GRANTS ON TABLE c.s.t; |
| External location | CREATE EXTERNAL LOCATION l URL 's3://…' WITH (STORAGE CREDENTIAL cred); |
| Volume | CREATE VOLUME c.s.v; → path /Volumes/c/s/v/ |
| Row filter | ALTER TABLE t SET ROW FILTER f ON (col); |
| Column mask | ALTER TABLE t ALTER COLUMN col SET MASK f; |
| Tag a column | ALTER TABLE t ALTER COLUMN col SET TAGS ('pii' = 'email'); |
| Table owner | ALTER TABLE t OWNER TO `g`; |
Delta and table commands
| Task | Command |
|---|---|
| Upsert | MERGE INTO t USING s ON … WHEN MATCHED … WHEN NOT MATCHED … |
| History / time travel | DESCRIBE HISTORY t; · SELECT * FROM t VERSION AS OF 5; |
| Undo a bad load | RESTORE TABLE t TO VERSION AS OF 5; |
| Compact / cluster | OPTIMIZE t; |
| Clean old files | VACUUM t; (default 7 days) |
| Change Data Feed | SET TBLPROPERTIES (delta.enableChangeDataFeed = true) · table_changes('t', 5) |
| Clone for testing | CREATE TABLE t_dev SHALLOW CLONE t; |
| Details / size | DESCRIBE DETAIL t; |
| Constraint | ALTER TABLE t ADD CONSTRAINT c CHECK (amount > 0); |
Which feature for which need
| Need | Use | Instead of |
|---|---|---|
| Incremental file ingestion | Auto Loader / read_files streaming table | Listing folders yourself |
| SCD2 from a CDC feed | Lakeflow AUTO CDC … STORED AS SCD TYPE 2 | Hand-written MERGE logic |
| SCD2 from snapshots in a job | Delta MERGE with union pattern + row hash | Delete-and-reload |
| Data quality in pipelines | Expectations | Separate validation jobs |
| Data layout for new tables | Liquid clustering / CLUSTER BY AUTO | Partitioning + ZORDER |
| Table maintenance | Predictive Optimization | Scheduled OPTIMIZE/VACUUM jobs |
| Row/column security | Row filters, column masks, governed tags | Many secured views |
| Share data externally | Delta Sharing | File exports |
| Query other databases | Lakehouse Federation | Copy pipelines for occasional queries |
| Deploy jobs to environments | Asset Bundles | Manual UI configuration |
| BI SQL | Serverless SQL warehouse | All-purpose clusters |
| Cost visibility | system.billing.usage + tags | Guessing from invoices |
Renamed features (old name → current)
| Old name | Current name |
|---|---|
| Delta Live Tables (DLT) | Lakeflow Declarative Pipelines |
| APPLY CHANGES INTO | AUTO CDC |
| Databricks Workflows | Lakeflow Jobs |
| Hive metastore tables | Unity Catalog tables (migrate with SYNC / UCX) |
| dbx / DBFS mounts | Asset Bundles / UC volumes and external locations |