Databricks SQL data access control
This article describes how data object owners manage access to data.
For a general overview of how to enable access to data, see Access control.
Important
Data access control is always enabled in Databricks SQL even if table access control is not enabled in the Databricks Data Science & Engineering workspace. Before a user can access any schemas, tables, and views, the user must first be granted access using data access commands.
If table access control is enabled in Databricks Data Science & Engineering and you have already specified ACLS (granted and denied privileges) in the workspace, those ACLs are respected in Databricks SQL.
You can manage ownership and permissions by using Data Explorer or by running security commands in the SQL editor.
Note
You cannot manage ownership or permissions for schemas or tables in the samples
catalog. This catalog is provided read-only to users in all workspaces.
Manage ownership and permissions in Data Explorer
Manage data object ownership
You must be a Databricks admin to view and manage data object ownership.
If you do not have permission to see the owner, the Owner field displays .
If the data object has no owner, the Owner field displays .
Edit schema ownership
Click
Data in the sidebar.
Select a running SQL warehouse in the drop-down list at the top right. The
default
schema is selected. The schema comment and owner displays and the selected Details tab shows the schema location and properties.Select the targeted schema under Data Explorer.
In the Owner field, click the
.
In the Set owner for
<schema-name>
dialog, click, and select an owner.
Edit table ownership
Click
Data in the sidebar.
Select a running SQL warehouse in the drop-down list at the top right. The
default
schema is selected. The schema comment and owner displays and the selected Details tab shows the schema location and properties.Select the targeted schema under Data Explorer.
Click the Filter tables field. Optionally type a string to filter the tables.
Select the targeted table.
In the Owner field, click the
.
In the Set owner for <schema-name.table-name> dialog, click
, and select an owner.
Manage data object permissions
You must be a Databricks admin or the data object owner to view and manage data object permissions.
Manage schema permissions
Click
Data in the sidebar.
Select a running SQL warehouse in the drop-down list at the top right. The
default
schema is selected. The schema comment and owner displays and the selected Details tab shows the schema location and properties.Select the targeted schema under Data Explorer.
Click the Permissions tab.
Grant or revoke privileges.
Grant
Click Grant.
Optionally type a string to filter the principals and select a principal.
Select the checkboxes next to the privileges to grant.
Click OK.
Revoke
Select the checkbox next to a principal.
Click Revoke.
Manage table permissions
Click
Data in the sidebar.
Select a running SQL warehouse in the drop-down list at the top right. The
default
schema is selected. The schema comment and owner displays and the selected Details tab shows the schema location and properties.Select the targeted schema under Data Explorer.
Click the Filter tables field. Optionally type a string to filter the tables.
Select the targeted table.
Click the Permissions tab.
Grant or revoke privileges.
Grant
Click Grant.
Optionally type a string to filter the principals and select a principal.
Select the checkboxes next to the privileges to grant.
Click OK.
Revoke
Select the checkbox next to a principal.
Click Revoke.
Security commands
Data object owners apply the SQL GRANT
, DENY
, REVOKE
, and SHOW GRANTS
commands to manage access to data objects from users and groups. For a command reference, see Security statements.
To run SHOW GRANTS [<user>] <object>
you must be either:
A Databricks SQL administrator or the owner of
<object>
.The user specified in
[<user>]
.
For requirements for using these commands and a detailed explanation of the data governance model, see Data object privileges.
Example
To enable the user user@example.com
to access all tables in the default
schema, invoke the following commands:
REVOKE ALL PRIVILEGES ON SCHEMA default FROM `user@example.com`;
GRANT USAGE, SELECT, READ_METADATA ON SCHEMA default TO `user@example.com`;
SHOW GRANTS `user@example.com` ON SCHEMA default;
+------------------+---------------+------------+-----------+
| principal | ActionType | ObjectType | ObjectKey |
+------------------+---------------+------------+-----------+
| user@example.com | READ_METADATA | SCHEMA | default |
+------------------+---------------+------------+-----------+
| user@example.com | SELECT | SCHEMA | default |
+------------------+---------------+------------+-----------+
| user@example.com | USAGE | SCHEMA | default |
+------------------+---------------+------------+-----------+
When you run these commands in the SQL editor, you should see:
