Tech challenge · Databricks

An analyst can see the table but cannot query it

MediumDatabricks

You granted SELECT on main.sales.orders to the analysts group. An analyst still gets a permission error when querying it. What is missing?

Think it through or sketch an answer first, then open the hint or the solution.

Show a hint

In Unity Catalog, access to an object also needs access to its containers.

Show the solution

Unity Catalog checks the whole path: the group needs USE CATALOG on main, USE SCHEMA on main.sales, and SELECT on the table. Granting at schema level gives access to current and future tables in it, which is often what you want for a curated schema.

Example (SQL)

GRANT USE CATALOG ON CATALOG main TO `analysts`;
GRANT USE SCHEMA  ON SCHEMA main.sales TO `analysts`;
GRANT SELECT      ON TABLE  main.sales.orders TO `analysts`;

Common mistakes

  • Granting ALL PRIVILEGES to make the error go away.
  • Granting to individual users instead of groups, which becomes impossible to audit.

Learn more

More Databricks challenges

Today's challenge and the full archive