Unity Catalog (how security works)

Unity Catalog (how security works)

  • Securables: metastore → catalogs → schemas → tables/views/functions/materialized views → volumes/external locations → credentials. Privileges inherit downward (grant at catalog ⇒ applies to all current/future objects in its schemas). (Microsoft Learn, Databricks Documentation)

How to secure tables (and “hide” them)

  1. Grant only what’s needed on the parents
    If a user doesn’t have USE CATALOG (on the catalog) and USE SCHEMA (on the schema), they can’t even see the objects inside. Grant these only to people who should browse that area. (Microsoft Learn)
  2. Grant table-level access explicitly
    Give SELECT to read, MODIFY to write (append/update/delete), and keep MANAGE limited to data stewards. Example policy-by-group:
-- grant browse-only on the container
GRANT USE CATALOG ON CATALOG finance TO `analyst_ro`;
GRANT USE SCHEMA  ON SCHEMA  finance.curated TO `analyst_ro`;

-- allow read but not write
GRANT SELECT ON ALL TABLES IN SCHEMA finance.curated TO `analyst_ro`;

-- writers (still need USE privileges above)
GRANT MODIFY ON ALL TABLES IN SCHEMA finance.curated TO `etl_rw`;

(You can also grant at catalog level to cascade.) (Databricks Documentation)

  1. To “hide” tables
    Don’t grant USE CATALOG / USE SCHEMA on the parents. Note: in many workspaces the main catalog is browseable by default—use your own catalogs and control USE precisely. (Microsoft Learn)
  2. Fine-grained (when users share a schema):
  • Row filters and column masks (per table) to enforce row/column-level security.
  • Dynamic views for read-only, filtered projections. (Databricks Documentation)

What permissions exist? (most-used, by object)

  • Catalog: USE CATALOG, CREATE SCHEMA, plus cascade grants like SELECT, MODIFY, EXECUTE, MANAGE if given at catalog scope.
  • Schema: USE SCHEMA, CREATE TABLE/VIEW/FUNCTION/MATERIALIZED VIEW/VOLUME, SELECT, MODIFY, EXECUTE, MANAGE.
  • Table/View/MV: SELECT, MODIFY, REFRESH (MV), MANAGE.
  • Function/Procedure/Model: EXECUTE.
  • Volume: READ VOLUME, WRITE VOLUME.
    (Full matrix lives in docs.) (Microsoft Learn)

What is MANAGE?

Lets a principal view & change privileges, transfer ownership, drop/rename the object. It’s not included in ALL PRIVILEGES, and holders still need USE CATALOG/USE SCHEMA to reach the object. Think “privilege admin for this object.” (Databricks Documentation)


How to manage privileges on objects

  • SQL (works everywhere)
-- show, grant, revoke
SHOW GRANTS ON TABLE finance.curated.sales;
GRANT SELECT ON TABLE finance.curated.sales TO `analyst_ro`;
REVOKE SELECT ON TABLE finance.curated.sales FROM `analyst_ro`;
  • Catalog Explorer (UI): Data → pick object → Permissions tab → Grant/Revoke.
  • CLI and Terraform (databricks_grant) for automation / IaC. (Microsoft Learn, Terraform Registry)

What is Data Access Control in Databricks?

Three systems, used together:

  1. Unity Catalog for data objects (tables/views/functions/volumes/etc.).
  2. Workspace ACLs for notebooks, repos, clusters/SQL warehouses, etc.
  3. Account RBAC for account-level resources (users/groups/SPs, workspaces). (Databricks Documentation, Microsoft Learn)

Different ways to provide privileges in UC


Securing files behind tables

  • Use storage credentials + external locations for governed access to cloud storage, then build tables/volumes on top.
  • For files (non-tabular), use Volumes with READ VOLUME / WRITE VOLUME. (Microsoft Learn)

Row/column-level security (copy-paste starters)

Column mask (show full SSN only to auditors):

CREATE OR REPLACE FUNCTION governance.mask_ssn(ssn STRING) RETURNS STRING
RETURN CASE WHEN is_account_group_member('auditors') THEN ssn ELSE concat('XXX-XX-', right(ssn,4)) END;

ALTER TABLE finance.curated.customers
ALTER COLUMN ssn SET MASK governance.mask_ssn;

Row filter (only see own region):

CREATE OR REPLACE FUNCTION governance.row_is_my_region(rgn STRING) RETURNS BOOLEAN
RETURN rgn = current_user_region();  -- your UDF/lookup

ALTER TABLE finance.curated.orders
SET ROW FILTER governance.row_is_my_region ON (region);

Docs include ABAC-based (tag) policies if you prefer central governance. (Databricks Documentation)


End-to-end “secure by default” checklist

  1. Model data: catalogs per domain/env; schemas for bronze/silver/gold.
  2. Least privilege: grant USE only where browsing is allowed; SELECT/MODIFY only to the right groups; MANAGE to stewards. (Microsoft Learn)
  3. Govern files: external locations + volumes; avoid direct keys on clusters. (Microsoft Learn)
  4. Fine-grained controls: row filters, masks, or dynamic views. (Databricks Documentation)
  5. Automate via Terraform/CLI; audit with system tables & lineage (Catalog Explorer). (Terraform Registry)

Related Posts

Z-ORDER in Databricks: Magic or Myth?

When it helps, when it hurts, how to pick columns, and what KPIs to measure. Introduction: Why the Hype Around Z-ORDER? If you’ve spent time in Databricks,…

Read More

Taming Small Files in Delta Lake

Optimal file sizes, compaction strategies, and how to keep your Delta tables lightning-fast Why Small Files Are a Big Problem Delta Lake is powerful, but it inherits…

Read More

Databrick Serverless compute plane networking

Here’s a simple line-by-line summary of the Serverless compute plane networking (08/04/2025): General idea Serverless egress control (outbound connections) Network Connectivity Configuration (NCC) What NCC enables: Extra…

Read More

Databrick Serverless compute limitations

Here’s a simple, line-by-line summary of the Serverless compute limitations (09/29/2025): General limitations Streaming limitations Machine learning limitations Notebook limitations Job limitations Compute-specific limitations Caching limitations Hive…

Read More

Best practices for Databrick serverless compute

Best practices for serverless compute Big picture Before you migrate Ingesting data (getting data in) Querying external data (without moving it) Spark configurations Watch your costs Quick…

Read More

Databrick Serverless compute release

Here’s a simple line-by-line summary of the important points from the Serverless Compute release notes (09/24/2025): Perfect 👍 Here’s a one-page cheat sheet table for the Serverless…

Read More
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x