SaveMyCert
Log in
5 of 5 free questions left today·for 30 a day
Governance and Security

Unity Catalog Managed vs External Tables, GRANT, REVOKE and DENY (Databricks Data Engineer Associate)

16 min readDatabricks DEA · Governance and SecurityUpdated

Unity Catalog governance for a data engineer comes down to two decisions: whether a table is managed (Unity Catalog owns its storage and file lifecycle) or external (the files live at a LOCATION you choose), and which privileges each principal holds at which level of the catalog, schema and table hierarchy. This lesson covers creating, modifying, dropping, recovering and converting managed and external tables; the privileges external locations need; users, groups and service principals; GRANT and REVOKE in SQL and in Catalog Explorer; inheritance and why a REVOKE can leave access in place; ownership versus MANAGE; and why the legacy DENY statement has no Unity Catalog equivalent.

What you’ll learn
  • Choose between a managed and an external table from requirements about storage paths, file formats, outside readers and data lifecycle
  • Create managed and external tables, predict where managed files are stored, and grant the storage-side and catalog-side privileges each needs
  • Predict what DROP TABLE does to each table type and recover dropped tables with UNDROP, SHOW TABLES DROPPED and UNDROP TABLE WITH ID
  • Convert external tables to managed with SET MANAGED, roll back with UNSET MANAGED, and produce external files from a managed table
  • Grant and revoke privileges in SQL and in Catalog Explorer to users, account-level groups and service principals at the narrowest level that covers the need
  • Explain why a REVOKE can leave access in place, why DENY does not work in Unity Catalog, and how ownership, MANAGE and ALL PRIVILEGES differ

Managed vs external tables: what Unity Catalog owns

A managed table is a Unity Catalog table whose data files live in managed storage that Unity Catalog chooses and controls; an external table is a Unity Catalog table registered over files at a path you name with a LOCATION clause, inside an external location. Both are governed by the same grants. What differs is who owns the files: the catalog, or you.

QuestionManaged tableExternal table
How it is createdCREATE TABLE with no LOCATIONCREATE TABLE ... LOCATION '<path>' on a path covered by an external location
Who picks the storage pathUnity Catalog, inside the schema, catalog or metastore managed locationYou
FormatsDelta Lake or Apache IcebergDelta, plus formats such as CSV, JSON, Avro, Parquet, ORC and text
Data lifecycle and optimizationManaged by Databricks; eligible for predictive optimizationYour responsibility
Outside engines reading the files by pathNot the intended pattern; read through Unity CatalogYes: the files stay where other tools expect them
Effect of DROP TABLEFiles deleted after the recovery periodMetadata removed; files left in place

Databricks recommends managed tables by default. Choose an external table when the files must stay at a known path for tools outside Databricks, when another system keeps writing them, or when the data is in a format managed tables do not support, for example CSV files a vendor drops into a folder every hour. Note that a volume is a different object: it governs files, not a table, so it is not a substitute when users need a governed table to query.

Creating managed tables and where their files go

A managed table is created by leaving out the location: CREATE TABLE retail.curated.store_visits (...) or a CTAS such as CREATE TABLE retail.curated.daily_visits AS SELECT .... Delta is the default format, so no USING clause is needed.

Unity Catalog stores the files in the most specific managed location available:

  1. the schema's managed location, if the schema has one;
  2. otherwise the catalog's managed location;
  3. otherwise the metastore's managed storage.

So when one schema in a catalog has its own location and a sibling schema does not, the sibling's tables fall back to the catalog's location rather than failing. To isolate one schema's managed data in a dedicated bucket (for an audit or data-residency requirement) while leaving the rest of the catalog alone, set the location on that schema, not on the catalog:

CREATE SCHEMA retail.restricted
  MANAGED LOCATION 's3://retail-restricted/tables';

Setting a catalog's or schema's managed location needs CREATE MANAGED STORAGE on the external location that covers the path, in addition to the catalog-side privilege (for example CREATE SCHEMA on the catalog). Putting a LOCATION on individual tables instead would make them external tables, not managed ones in a new place.

Creating external tables and the privileges they need

An external table is created with a LOCATION on a path that an external location covers (an external location pairs a cloud path with a storage credential):

CREATE TABLE retail.landing.supplier_feed (
  supplier_id STRING, shipped_at TIMESTAMP, qty INT)
USING CSV
OPTIONS (header 'true')
LOCATION 's3://retail-landing/supplier-feed/';

Unity Catalog checks two sides before it registers the table:

  • Storage side: CREATE EXTERNAL TABLE on the external location (or storage credential) covering the path. Databricks recommends granting it on the external location, because it is scoped to a path.
  • Catalog side: USE CATALOG on the catalog, plus USE SCHEMA and CREATE TABLE on the destination schema.

Each use of an external location has its own privilege, and they are easy to confuse:

Privilege on an external locationWhat it allows
CREATE EXTERNAL TABLERegister external tables at paths it covers
CREATE MANAGED STORAGEUse a path as a catalog's or schema's managed location
CREATE EXTERNAL VOLUMECreate external volumes on paths it covers
READ FILES / WRITE FILESRead or write files directly by path (WRITE FILES also needs READ FILES); neither lets you create a table
BROWSESee metadata only

For least privilege, grant CREATE TABLE on the one schema that will hold the tables. Granting it on the catalog also works but inherits to every schema in it, including the ability to create managed tables elsewhere.

Dropping tables and recovering them with UNDROP

DROP TABLE behaves differently for the two table types. For a managed table, Unity Catalog marks the table dropped and keeps it recoverable for a recovery period (7 days by default, configurable at catalog or schema level, with the schema setting taking precedence); after that, Databricks deletes the data files. For an external table, DROP removes only the metadata: the files at the LOCATION stay in place, and engines that read them by path keep working.

Within the recovery period, UNDROP TABLE restores a dropped table with its data and history:

UNDROP TABLE retail.curated.store_visits;

-- several dropped tables share the name? find the right one
SHOW TABLES DROPPED IN retail.curated;
UNDROP TABLE WITH ID '<table-id>';

Undrop by name restores the most recently dropped table of that name owned by you. If a table was dropped, recreated and dropped again, each is a separate table with its own ID, so use SHOW TABLES DROPPED to find the older one and UNDROP TABLE WITH ID to restore it. Time travel cannot help here: RESTORE and DEEP CLONE need a table that exists, and the recreated table has its own separate history.

Permissions for UNDROP: you must own the table (or hold MANAGE on it) and have CREATE TABLE and USE SCHEMA on the schema and USE CATALOG on the catalog. Undropping an external table re-registers its path, so it also needs CREATE EXTERNAL TABLE on the external location or storage credential.

Once the recovery period has passed, an external table can still be brought back with its full Delta history by creating a table again with LOCATION on the same path, because its files and transaction log were never deleted (unless something outside Databricks removed them).

Converting external tables to managed with SET MANAGED

ALTER TABLE ... SET MANAGED converts an existing external Delta table into a Unity Catalog managed table in place. It copies the data and log into managed storage and keeps the table's name, settings, permissions, dependent views and history, so jobs and dashboards that reference the table by name keep working, and the table starts benefiting from managed-table features such as predictive optimization.

ALTER TABLE retail.landing.pos_events SET MANAGED;

Requirements and behaviour to know:

  • Owner only. You must own the table; MANAGE is not enough for an external table.
  • Compute: serverless, or Databricks Runtime 17.3 LTS or above. Readers and writers of the table should run Databricks Runtime 15.4 LTS or above.
  • Downtime: the copy runs without downtime; writers are briefly blocked (minutes) during the switch.
  • Streaming: existing read and write streams on the table fail after the conversion and must be restarted.
  • Delta Sharing: Databricks-to-Databricks recipients do not automatically follow the table to its new location; reshare it with ALTER SHARE.

Re-granting privileges or recreating views after the conversion is unnecessary, because both are preserved. A CTAS or deep clone into a new managed table is the wrong tool when grants and history must be kept: each creates a new table without the original's grants (and CTAS has no history).

Going back to external: UNSET MANAGED and copying

ALTER TABLE ... UNSET MANAGED rolls a SET MANAGED conversion back to an external table, and it only works within 14 days of that conversion (on serverless or Runtime 17.3 LTS and above). Databricks keeps the source data in the external location during that window, and the rollback keeps writes made after the conversion. Seven days after a rollback, Databricks deletes the copy in managed storage.

Two things UNSET MANAGED is not:

  • It is not a general managed-to-external switch. A table that was created managed has no conversion to roll back.
  • It is not available after the window. Past 14 days the table is simply a managed table.

In both cases, getting external files at a path means writing the data to a new external table, with a CTAS or a deep clone that specifies a LOCATION under an external location. A shallow clone does not help: it keeps the source's table type. Re-creating a table over the old pre-conversion path is also a trap, because that path stops receiving writes after the conversion and holds stale data, and RESTORE rewinds versions without changing the table type.

GoalTool
External to managed, keeping name, grants and historySET MANAGED
Undo a conversion within 14 days, keeping new writesUNSET MANAGED
External files from a table born managed, or after the 14 daysNew external table: CTAS or deep clone with LOCATION

Principals and the securable hierarchy

Unity Catalog grants privileges to three kinds of principal, each named in backticks after TO or FROM:

  • Users, by the email address they sign in with: `dana.ortiz@example.com`. Display names do not resolve.
  • Service principals, the non-human identities jobs and pipelines run as, by their application ID (a UUID), not their display name.
  • Groups, by name. Unity Catalog accepts account-level groups only; workspace-local groups cannot be used in Unity Catalog grants. Granting to a group lets membership changes drive access with no grant edits.

Securables form a hierarchy: metastore → catalog → schema → table, view, volume, function or model, with storage credentials and external locations as separate securables at the metastore level. The full name of a table is three-level: catalog.schema.table.

Two rules govern how privileges flow through that hierarchy:

  • Usage privileges gate everything. To touch any object you need USE CATALOG on its catalog and USE SCHEMA on its schema. SELECT on a table alone fails with a permission error. BROWSE and READ METADATA are discovery privileges and do not substitute.
  • Grants inherit downward to current and future child objects. SELECT on a schema covers every table in it, including tables created later; USE SCHEMA granted on a catalog covers every schema in it, including future ones.

Choose the narrowest container that covers the need: a schema grant when a group must read everything in one schema (including new tables) but nothing else; a catalog grant only when every schema, present and future, is in scope; table grants when only specific tables are allowed.

GRANT and REVOKE in SQL and in Catalog Explorer

GRANT adds privileges on one securable to one principal, and REVOKE removes a privilege that was granted on that same securable to that same principal:

GRANT USE CATALOG ON CATALOG retail TO `bi-readers`;
GRANT USE SCHEMA, SELECT ON SCHEMA retail.curated TO `bi-readers`;
REVOKE SELECT ON SCHEMA retail.curated FROM `bi-readers`;

Common privilege sets:

NeedPrivileges (plus USE CATALOG and USE SCHEMA)
Read a tableSELECT
Insert, update or delete, including MERGEMODIFY and SELECT on the target; SELECT on any source
Create tables in a schemaCREATE TABLE on the schema (plus CREATE EXTERNAL TABLE on an external location for external tables)
Create schemas in a catalogCREATE SCHEMA on the catalog
Delegate administration without data accessMANAGE

MODIFY on its own is not enough to write: Unity Catalog requires SELECT on the table too. For least privilege, grant both on the single target table rather than on its schema, which would open every table in the schema to writes.

The UI equivalent lives in Catalog Explorer: open the catalog, schema, table or other securable, go to its Permissions tab, and use Grant (pick principals and privileges) or select an existing grant and use Revoke. Owners, MANAGE holders and admins can do this. Workspace identity settings manage the principals themselves, and SQL warehouse permissions govern compute use; neither grants data access.

Why REVOKE doesn't always cut access, and what happened to DENY

A REVOKE only removes a grant made on that exact object to that exact principal. It does not override access the principal gets from elsewhere, and it succeeds silently when there was nothing to remove. Access can survive a REVOKE through:

  • Inheritance: a SELECT granted on the catalog or schema still reaches the table after a table-level REVOKE.
  • Group membership: a user who also belongs to a group with access keeps that access after their personal grant is revoked.
  • Ownership: an owner's implicit rights are not grants and cannot be revoked.

To actually remove access, change the grant that provides it: replace a broad catalog-level grant with grants on only the schemas the group should read, take the user out of the group, or transfer ownership.

DENY is the official guide's third statement, and it is where many learners slip. DENY belongs to the legacy table access control model and applies only to the hive_metastore catalog: there, a denied privilege overrode any grant, and denying on a schema or database implicitly denied every object in it. Unity Catalog does not support the DENY statement. When workloads move from hive_metastore, a "grant broadly, deny one table" pattern has to be rebuilt as narrow grants that never include the restricted object. Unity Catalog's attribute-based access control (ABAC) policies can also express restrictions centrally; they are covered in the lesson on column masking, row filters and ABAC. If you meet "ABAC DENY policies" in the docs, note that they are a separate, tag-based Beta mechanism (currently limited to the MANAGE ACCESS CONTROL privilege), not a DENY statement: for data privileges such as SELECT, the answer is still to grant narrowly.

Legacy hive_metastore table ACLsUnity Catalog
GRANT / REVOKEYesYes
DENY statementYes; overrides grantsNot supported
How to exclude one objectDENY on itGrant only at levels that don't include it

Modifying tables: ownership, MANAGE and ALL PRIVILEGES

Basic table modifications use ALTER TABLE (rename with RENAME TO, add or change columns, set properties, transfer ownership with OWNER TO), and who may run them depends on ownership and the MANAGE privilege. Every securable has one owner, by default its creator, who implicitly holds every capability on it. Those rights are not grants, so REVOKE cannot remove them; only a transfer does:

ALTER TABLE retail.curated.store_visits OWNER TO `retail-platform`;

Transferring ownership to a group is the usual hand-over when someone leaves the team; the old owner keeps no implicit rights on that table afterwards (they keep any access that comes from owning the parent schema or catalog, or from explicit grants). Owners, MANAGE holders and metastore admins can transfer ownership. Three ways of holding broad power over an object are easy to mix up:

OwnerMANAGEALL PRIVILEGES
How you get itCreate the object, or ALTER ... OWNER TOGRANT MANAGEGRANT ALL PRIVILEGES
Grant and revoke for othersYesYesNo
Rename, drop, transfer ownershipYesYesNo
Read or write dataYes, implicitlyNo, until the holder grants themselves e.g. SELECTYes (every applicable privilege except MANAGE)
RevocableNo; transfer ownership insteadYesYes

MANAGE is the delegation privilege: a data steward can handle access requests, rename or drop tables, all without becoming owner. Granted on a schema or catalog, it extends to child objects, including future ones. Because a MANAGE holder can grant privileges to anyone, they can grant themselves SELECT, so MANAGE is not a data barrier; audit such self-grants if that matters. ALL PRIVILEGES does not include MANAGE.

Tip. Expect scenarios in which a data engineer must meet a stated requirement: files that must stay at a path for an outside engine, data that must stay managed, least privilege, access that must cover future tables or schemas, or a steward who must not get data access. Items ask which table type, statement, privilege set or grant level fits, or why an operation failed or left access in place. Harder items combine two facts, such as a conversion that fails on both ownership and runtime, an UNDROP that needs an extra storage privilege, a MERGE that needs SELECT alongside MODIFY, or a REVOKE defeated by inheritance where DENY is not available, and the options are near-twins that differ in one privilege, level or command.

Key takeaways
  • No LOCATION means a managed table (Delta or Iceberg, lifecycle owned by Unity Catalog); a LOCATION under an external location means an external table, which can also be CSV, JSON, Parquet and other formats.
  • Managed files go to the schema's managed location, else the catalog's, else the metastore's; setting one needs CREATE MANAGED STORAGE on the external location.
  • Creating an external table needs CREATE EXTERNAL TABLE on the external location plus USE CATALOG, USE SCHEMA and CREATE TABLE; READ FILES and WRITE FILES do not let you create tables.
  • Dropping a managed table deletes its files after the recovery period (7 days by default); dropping an external table leaves its files, so re-creating it on the same LOCATION brings it back.
  • UNDROP restores the most recently dropped table of that name; use SHOW TABLES DROPPED and UNDROP TABLE WITH ID for an older one; external undrops also need CREATE EXTERNAL TABLE.
  • SET MANAGED keeps name, grants, views and history; it needs the owner on serverless or Runtime 17.3 LTS+, and streams must be restarted and Databricks-to-Databricks shares reshared.
  • UNSET MANAGED only reverses a SET MANAGED within 14 days; otherwise write a new external table with CTAS or deep clone and a LOCATION.
  • Every access needs USE CATALOG and USE SCHEMA; grants inherit to current and future children, so grant at the narrowest container that covers the need.
  • REVOKE removes only a grant on that object; inherited, group and owner access survive it. DENY is hive_metastore-only, so in Unity Catalog you restrict by granting narrowly.
  • Users are named by email, service principals by application ID, and only account-level groups work; MANAGE delegates administration with no data access, and ALL PRIVILEGES excludes MANAGE.

Frequently asked questions

What is the difference between a managed and an external table in Unity Catalog?

A managed table stores its data in managed storage that Unity Catalog chooses and controls, in Delta or Iceberg format, and Databricks deletes its files after the recovery period when it is dropped. An external table is registered over files at a LOCATION you choose inside an external location, can use other formats such as CSV or Parquet, and dropping it removes only the metadata.

Can I convert an external table to a managed table in Databricks?

Yes. ALTER TABLE ... SET MANAGED converts an external Delta table in place, keeping its name, settings, permissions, views and history. The table owner must run it on serverless compute or Databricks Runtime 17.3 LTS or above, existing streams must be restarted afterwards, and Databricks-to-Databricks shares must be reshared.

Can I convert a managed table to an external table?

Only to undo a recent conversion: ALTER TABLE ... UNSET MANAGED rolls back a SET MANAGED within 14 days and keeps writes made since. A table created as managed, or one converted more than 14 days ago, has no in-place path back; create a new external table at a LOCATION with CTAS or a deep clone instead.

How do I recover a dropped table in Unity Catalog?

Run UNDROP TABLE with the table name within the recovery period, which is 7 days by default. If several dropped tables share the name, list them with SHOW TABLES DROPPED and run UNDROP TABLE WITH ID for the one you need. You need ownership or MANAGE, CREATE TABLE and USE SCHEMA on the schema, USE CATALOG, and for external tables CREATE EXTERNAL TABLE on the external location.

Does Unity Catalog support the DENY statement?

No. DENY applies only to the legacy hive_metastore catalog, where a denied privilege overrode grants. In Unity Catalog there is no DENY statement, so to keep a principal away from one object you grant privileges only at levels that do not include it, rather than granting broadly and subtracting.

Why can a user still query a table after REVOKE?

REVOKE removes only the grant made on that object to that principal. If the user inherits SELECT from a grant on the parent schema or catalog, gets it through a group they belong to, or owns the table, access continues. Change the grant that actually provides the access instead.

Why does SELECT on a table give a permission error in Unity Catalog?

Reading a table also requires USE CATALOG on its catalog and USE SCHEMA on its schema. SELECT alone is not usable without those usage privileges, and discovery privileges such as BROWSE do not replace them.

What does the MANAGE privilege allow in Unity Catalog?

MANAGE lets a principal grant and revoke privileges on an object, rename or drop it and transfer its ownership without being the owner. It includes no data access, so a MANAGE holder must grant themselves SELECT or MODIFY to work with the data, and ALL PRIVILEGES does not include MANAGE.

Source

This lesson covers the "Governance and Security" domain of the official Databricks DEA exam guide. Vendors revise their guides — check the source for the current version.

Test yourself on this topic
Practice now

Sign up free to mark lessons complete, bookmark topics and track your exam readiness.

Spotted a mistake in this lesson?