Privileges & GRANT

Databricks · Unity Catalog & Governance

Theory

Unity Catalog permissions use standard SQL: GRANT privilege ON object TO principal, and REVOKE to remove it. Principals are users, groups and service principals; granting to groups is best practice. Privileges are inherited downward: a grant on a catalog applies to every current and future schema and table in it. To read a table a user needs USE CATALOG on the catalog, USE SCHEMA on the schema and SELECT on the table (or on the schema or catalog).

Common privileges: SELECT (read), MODIFY (insert, update, delete), CREATE TABLE, CREATE SCHEMA, READ VOLUME, WRITE VOLUME, EXECUTE (functions), BROWSE (see metadata without data access), MANAGE and ALL PRIVILEGES. Each object has an owner who can grant on it. For example, to let the analysts group query every table in main.sales: GRANT USE CATALOG ON CATALOG main TO analysts; GRANT USE SCHEMA, SELECT ON SCHEMA main.sales TO analysts.

Why we use it

Data must be shared with the right people only. SQL-based grants give one consistent, auditable permission model across notebooks, SQL warehouses, jobs and BI tools, instead of per-tool security.

When to use it

Grant to groups, at the highest level that is still correct (often the schema). Use table-level grants for exceptions and row filters or column masks when users may see only part of a table. Review with SHOW GRANTS.

How it works

  1. User runs SELECT on main.sales.orders
  2. Has USE CATALOG on main? Yes: Check the schema. No: Permission denied.
  3. Has USE SCHEMA on main.sales? Yes: Check the table. No: Permission denied.
  4. Has SELECT on the table, schema or catalog? Yes: Rows are returned. No: Permission denied.
  5. Every check is written to the audit log

Syntax

GRANT <privilege>[, ...] ON <CATALOG | SCHEMA | TABLE | VOLUME | FUNCTION> name TO `principal`
REVOKE <privilege> ON <object> FROM `principal`
SHOW GRANTS [`principal`] ON <object>
ALTER TABLE t OWNER TO `group`
Privileges: USE CATALOG, USE SCHEMA, SELECT, MODIFY, CREATE TABLE, READ VOLUME, WRITE VOLUME, EXECUTE, BROWSE, MANAGE, ALL PRIVILEGES

Example

-- Analysts can read everything in main.sales
GRANT USE CATALOG ON CATALOG main TO `analysts`;
GRANT USE SCHEMA, SELECT ON SCHEMA main.sales TO `analysts`;

-- Engineers can also write and create tables
GRANT USE SCHEMA, SELECT, MODIFY, CREATE TABLE ON SCHEMA main.sales TO `data-engineers`;
GRANT READ VOLUME, WRITE VOLUME ON VOLUME main.sales.raw_files TO `data-engineers`;

-- Check and undo
SHOW GRANTS ON SCHEMA main.sales;
REVOKE MODIFY ON SCHEMA main.sales FROM `data-engineers`;

Key points

Databricks topics

Databricks Fundamentals

Compute

Notebooks & Development

Apache Spark on Databricks

Delta Lake

Unity Catalog & Governance

Data Ingestion

Declarative Pipelines (Lakeflow)

Lakeflow Jobs

Databricks SQL & BI

Architecture, Performance & Cost

Machine Learning & AI

Certification & Interview

T
Tech Town
Log InSign Up Free
Home SQL Python DSA Power BI Snowflake Databricks Spark Gen AI Practice Problems Contest Blog

Master Databricks

The lakehouse platform from the ground up: Apache Spark, Delta Lake, Unity Catalog, Lakeflow pipelines and jobs, Databricks SQL and MLflow. Click any topic in the sidebar to open it right here.

{{ sectionCount }}
Sections
{{ topicCount }}
Topics
Free
Forever
Hands-on practice Practice SQL / Spark SQL Sharpen the SQL you use in Databricks SQL and Spark SQL: 150 query problems in a live editor with instant checking. Start practising →
Section {{ sec.num }}

{{ sec.label }}

Databricks  /  {{ current.sectionLabel }}  /  {{ current.name }}

{{ current.name }}

Theory

{{ current.def }}

Why we use it

{{ rich.why }}

When to use it

{{ rich.when }}

{{ sec.h }}

{{ sec.body }}

{{ sec.body }}

Diagram

{{ rich.dg.caption }}

{{ tb.title }}
{{ c.v }}
{{ rich.dg.op }}
➜
{{ rich.dg.output.title }}
{{ c.v }}
{{ nd.label }}
{{ nd.sub }}
{{ nd.label }}
{{ nd.sub }}
{{ rich.dg.left.title }}
{{ it }}
{{ rich.dg.right.title }}
{{ it }}
On screen — where to click

{{ rich.ui.title }}

{{ u.text }}
  1. {{ st.n }}{{ st.text }}
{{ rich.ui.title }}
{{ u.text }}
Flowchart — how it works
{{ nd.text }}
{{ nd.text }}
◇ {{ nd.text }}
Yes → {{ nd.yes }}
No → {{ nd.no }}
Syntax
{{ current.syntax }}
Example
{{ current.example }}
Want to run this yourself? Databricks needs a real workspace — there's no in-browser engine for it. Click Copy above, then paste it into a notebook or the SQL editor in Databricks Free Edition (free, no credit card) and run it on serverless compute.
Key Points — click to check off as you learn
  • {{ pt.mark }} {{ pt.text }}

Share this topic