Interview/Databricks

Databricks interview questions: Unity Catalog

Interactive Databricks interview questions on Unity Catalog. Practice with the matching lesson. catalog.schema.table with metastore-level governance, privileges, and lineage — not hive_metastore.default.

Lesson · Simulation

What is Unity Catalog's three-level namespace?

Answer it out loud, then reveal. Play steps through like the simulators.

Production scenario

Unity Catalog

Finance reads bronze because gold grants were missing

Symptoms

  • Workspace members saw everything in hive_metastore
  • UC gold had no SELECT

All questions on this page

Indexed as FAQ. Open any item if you prefer a list to Play.

Showing 9 of 9 questions.

beginner

What is Unity Catalog's three-level namespace?

Unity Catalog · tap to open the answer

Say this first: catalog.schema.table (plus volumes for files).

Why: It is the governance plane: grants, lineage, audit. Table files still live in cloud storage. hive_metastore is the old two-level world.

Common mistake: Unity Catalog as a replacement for Delta files.

Follow-up they will ask: Where do you grant SELECT — catalog, schema, or table?

Lesson · Simulation

intermediate

A user can see a table in the UI but Spark says permission denied. Why?

Unity Catalog · tap to open the answer

Say this first: Workspace access ≠ UC privilege on that catalog/schema/table.

Why: They need USE CATALOG, USE SCHEMA, and SELECT (or a share). Cluster must be UC-enabled. A personal compute with the wrong catalog still fails.

Common mistake: Making the table public because 'they're in the workspace'.

Follow-up they will ask: What's the difference between a storage credential and an external location?

Lesson · Simulation

senior

How do you share a gold table with another cloud account without copying files?

Unity Catalog · tap to open the answer

Say this first: Delta Sharing / UC shares — grants on a share, not a second lake.

Why: Recipient gets access through the sharing protocol. Your storage stays. Don't clone PII into their bucket 'to make BI easy'. Lineage should show the share.

Senior depth: The files. UC stores metadata and grants; the bytes stay in the owner’s storage unless you explicitly copy.

Common mistake: COPY INTO their account as the default share mechanism.

Follow-up they will ask: What must still live in the data plane?

Lesson · Simulation

beginner

You dropped a table and the files were still in the bucket. Another time you dropped one and the data was gone. What is the difference?

Unity Catalog · tap to open the answer

Say this first: Managed tables are owned by Unity Catalog, so DROP removes the data too; external tables only lose their registration and the files stay.

Remember these

  • Managed table: Unity Catalog owns the files, DROP deletes data
  • External table: DROP removes registration only, files remain
  • DESCRIBE EXTENDED shows the table type and location
  • UNDROP recovers a managed table only within a retention window

Why: A managed table lives in the managed storage location of its catalog or schema, and Unity Catalog owns its lifecycle, so DROP removes the metadata and the underlying files — recoverable only through UNDROP inside a retention window. An external table is created with an explicit LOCATION inside an external location you registered, so DROP removes the registration and leaves every Parquet file and the _delta_log where they were. DESCRIBE EXTENDED or Catalog Explorer tells you which kind you have and where it points, and that is the command to run before any cleanup script. The trap cuts both ways: people drop a managed table expecting a harmless metadata operation, and people drop external tables expecting storage to be reclaimed and then wonder why the bill is unchanged. Choose deliberately — managed for anything whose lifecycle you want governed, external when another system owns the files.

DESCRIBE EXTENDED finance.gold.orders;
UNDROP TABLE finance.gold.orders;

Common mistake: Assuming DROP TABLE is always metadata-only, the way it was for an external path in hive_metastore.

Follow-up they will ask: Which would you choose for a bronze landing table, and why?

Lesson · Simulation

intermediate

A job needs to read abfss://.../raw/ as a governed table. Walk me from the storage account to a SELECT.

Unity Catalog · tap to open the answer

Say this first: Create a storage credential for the cloud identity, an external location over the path prefix, grant on that location, then define the external table or volume.

Remember these

  • Storage credential holds the cloud identity Unity Catalog uses
  • External location binds a URL prefix and is the grantable object
  • READ FILES and WRITE FILES are granted on the external location
  • Direct path access from compute bypasses all of it, including audit

Why: The storage credential wraps the cloud identity — an IAM role or an Azure managed identity — that Unity Catalog uses to reach storage, so no cluster needs its own credentials for that path. An external location binds a URL prefix to that credential and becomes the grantable object, which is what makes GRANT READ FILES ON EXTERNAL LOCATION possible. On top of it you define external tables or external volumes, which inherit governed access and show up in lineage and audit. Two layers exist so a path can be revoked once centrally instead of on every cluster that happened to have an instance profile. The failure mode to name out loud: if compute can still read that path directly, you have a second ungoverned route and the audit log will not show those reads at all.

CREATE EXTERNAL LOCATION raw_zone
  URL 'abfss://lake@acct.dfs.core.windows.net/raw'
  WITH (STORAGE CREDENTIAL lake_cred);
GRANT READ FILES ON EXTERNAL LOCATION raw_zone TO `data-eng`;

Common mistake: Attaching an instance profile to the cluster and calling that Unity Catalog governance.

Follow-up they will ask: How would you stop a cluster from reading that path directly, outside Unity Catalog?

Lesson · Simulation

advanced

An engineer left the company and now a nightly job fails on a table that nobody is able to grant access on. What is going on?

Unity Catalog · tap to open the answer

Say this first: That user's identity owned the table, and only the owner or an admin can GRANT, so ownership has to be reassigned — usually to a group.

Remember these

  • Ownership, not ALL PRIVILEGES, confers the right to grant
  • A metastore admin or parent owner can reassign ownership
  • ALTER ... OWNER TO a group removes the single point of failure
  • SHOW GRANTS shows privileges; Catalog Explorer shows the owner

Why: Every Unity Catalog securable has an owner, and ownership is not a privilege you can hand out piecemeal — it is what confers the right to GRANT, ALTER, and DROP that object. When the owner is a departed individual the object is effectively orphaned: colleagues with ALL PRIVILEGES still cannot delegate access. A metastore admin, or the owner of the parent catalog or schema, fixes it with ALTER TABLE ... OWNER TO, and Catalog Explorer shows the owner per object next to the grants. The durable answer is that production objects should be owned by a group or a service principal from the start so no leaver creates this situation. SHOW GRANTS lists the privileges, which is a separate question from who owns the thing.

ALTER SCHEMA finance.gold OWNER TO `data-platform-owners`;
SHOW GRANTS ON TABLE finance.gold.orders;

Senior depth: I treat ownership as an operational risk register rather than a detail. Any object with a human owner in production is a future incident, so I audit owners across the metastore and reassign anything production-critical to a group or service principal. The groups come from the account level through identity federation, so a leaver loses access everywhere at once without orphaning the object. Then onboarding and offboarding stop touching Unity Catalog grants at all, which is the only version of this that survives staff turnover.

Common mistake: Granting themselves ALL PRIVILEGES and expecting that to include the ability to grant onward.

Follow-up they will ask: Why isn't ALL PRIVILEGES the same thing as ownership?

Lesson · Simulation

advanced

An auditor asks which dashboards consume PII from one specific silver table. How do you answer in ten minutes?

Unity Catalog · tap to open the answer

Say this first: Unity Catalog lineage for downstream tables, notebooks, and dashboards, plus the audit log for who actually read it.

Remember these

  • Lineage is captured from queries on Unity Catalog-enabled compute
  • Column-level lineage traces a PII column into specific gold columns
  • system.access tables make lineage and audit queryable instead of clickable
  • Direct path reads and non-UC compute are invisible to lineage

Why: Unity Catalog captures lineage automatically from queries run on Unity Catalog-enabled compute, so Catalog Explorer's Lineage tab gives upstream and downstream tables and the notebooks, jobs, and dashboards attached to them. Column-level lineage narrows it further, showing which gold column was derived from the PII column rather than just which table touched it. The same information is queryable in system tables, so for an audit you filter instead of clicking through a graph. Read access itself lands in the audit log, which is how you answer the second half of the question — which principals selected that table in a given window. The caveat you must state: work done outside Unity Catalog-enabled compute, or by reading the storage path directly, never appears in lineage, which is exactly why path bypass is a governance problem rather than a convenience.

SELECT target_table_full_name, entity_type
FROM system.access.table_lineage
WHERE source_table_full_name = 'finance.silver.customers'

Senior depth: Lineage answers 'what is connected'; audit answers 'who actually looked'. An auditor almost always wants both, and the gap between them is the ungoverned path. So the real deliverable is not the lineage screenshot, it is closing the bypass: remove cluster-attached credentials, front every path with an external location, and require Unity Catalog access modes in policy. After that I tag PII columns so the next question is a single filter over system tables rather than a week of archaeology.

Common mistake: Promising complete lineage without mentioning that direct path reads leave no trace in it.

Follow-up they will ask: What would you tag so the next audit is a query rather than an investigation?

Lesson · Simulation

senior

Legal wants analysts to see only their own region's order rows and to see email addresses masked. Implement it without forty views.

Unity Catalog · tap to open the answer

Say this first: Attach a row filter and a column mask to the table with ALTER TABLE ... SET ROW FILTER and ALTER COLUMN ... SET MASK, so one table enforces it for every reader.

Remember these

  • Row filters and column masks are SQL UDFs attached to the table
  • The policy applies to every client, not just the view you handed out
  • is_account_group_member() makes behaviour depend on the caller
  • Owners and metastore admins need to be in the policy or they are the leak

Why: You write a SQL UDF that returns a boolean for the row filter and another that returns the masked value for the column, then attach them to the table itself. Every query through Unity Catalog applies them, whether it arrives from a notebook, a SQL warehouse, or a BI tool, because the policy lives on the securable rather than on a view someone has to be pointed at. The functions normally branch on the caller using is_account_group_member() or current_user(), so behaviour depends on identity instead of on which object was granted. This beats per-team views on two counts: one object to audit, and no way to query around the policy by reaching the base table. Make sure the policy covers privileged identities too, since the table owner and metastore admins are the obvious remaining leak.

ALTER TABLE finance.gold.orders
  SET ROW FILTER finance.gold.region_filter ON (region);
ALTER TABLE finance.gold.orders
  ALTER COLUMN email SET MASK finance.gold.mask_email;

Senior depth: The design principle is that the policy belongs on the data, not on the access path, because access paths multiply and nobody re-audits them. Filters and masks give me one object with one rule and a lineage graph that still works, instead of a view sprawl where the base table grant is the real permission model. I test it by querying as each group, including the owner, and I keep the functions in version control with the table definition so a policy change is a reviewed diff rather than an ALTER someone ran once.

Common mistake: Building one view per region and trusting that nobody is ever granted the base table.

Follow-up they will ask: Who can still see the raw column, and how would you prove it?

Lesson · Simulation

architect

Design the catalog layout for four business domains, three environments, and a shared conformed layer.

Unity Catalog · tap to open the answer

Say this first: One metastore per region, a catalog per domain and environment, medallion layers as schemas, and catalog bindings so prod catalogs are not writable from dev workspaces.

Remember these

  • Catalog per domain and environment, not one catalog with name prefixes
  • Medallion layers as schemas so a layer can be granted at once
  • Workspace bindings stop dev compute writing prod catalogs
  • Per-catalog managed storage keeps domains' files separated

Why: The catalog is the natural unit of isolation because grants, managed storage locations, and workspace bindings all attach there, so sales_prod, sales_dev, finance_prod beats a single catalog separated by naming conventions. Layers become schemas, which keeps the three-level name readable and lets you grant a whole layer at once — GRANT SELECT ON SCHEMA sales_prod.gold. Binding prod catalogs to prod workspaces means a dev notebook cannot write production data even if someone over-grants, so the compute boundary and the data boundary reinforce each other. The shared conformed layer gets its own catalog owned by the platform group with read grants outward, and anything crossing a metastore or an organisation goes through Delta Sharing rather than a copy. Give each catalog its own managed storage location so one domain's files are not interleaved with another's container, and define the whole thing in Terraform so the fifth domain is not a hand-built exception.

GRANT USE CATALOG ON CATALOG sales_prod TO `analysts`;
GRANT SELECT ON SCHEMA sales_prod.gold TO `analysts`;

Senior depth: I design it so that the common mistakes become impossible rather than discouraged. Environment separation at the catalog level plus workspace binding means a dev job physically cannot write prod. Layers as schemas means a grant is a sentence rather than a list of tables. Platform-owned conformed data means there is one place for shared keys instead of four domains cross-joining each other's silver. The thing I insist on is that this is code: catalogs, grants, bindings, and storage locations in Terraform, so the layout is reviewable and reproducible when the fifth domain arrives.

Common mistake: Putting everything in main and separating environments by table-name prefixes.

Follow-up they will ask: Where does the hive_metastore migration fit into that plan?

Lesson · Simulation