cancel
Showing results for 
Search instead for 
Did you mean: 
Data Governance
cancel
Showing results for 
Search instead for 
Did you mean: 

Privilege Issue When Running Delta Table SaveAsTable Command in Databricks Runtime 10.4

drii_cavalcanti
New Contributor III

I am attempting to execute the following command from a notebook on a runtime 10.4 cluster, but I'm encountering an error: "current user does not have privilege USAGE on Catalog".

To provide some context, I am using DBR 10.4 specifically because I need to retrieve sensitive data (which cannot be downloaded) from a SQL Server that requires a driver called 'net.sourceforge.jtds.jdbc.Driver' to establish a connection.

The code I'm attempting to run is:

df.write.format("delta").mode("append").saveAsTable(<catalog>.<schema>.<table>)

Is there any parameter that I am not aware of to suppress this permission issue? Any insights or guidance on resolving this privilege issue would be greatly appreciated.

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

Kaniz
Community Manager
Community Manager

Hi @drii_cavalcantiThe error you're encountering is related to the new USAGE privilege that is enforced on Databricks clusters running Databricks Runtime 7.3 LTS and above. This privilege is required to access an object in the database. To resolve this issue, you need to grant the USAGE privilege to your user. You can do this by logging into the workspace as an admin user, opening a notebook, and running the following command:

sql
GRANT USAGE ON DATABASE <databasename> TO <user-group>;

Replace <databasename> with the name of your database and <user-group> with your user or group name.If this doesn't solve your issue, you may need to check if the workspace has Unity Catalog metastore attached and if the cluster has UC-supported cluster access modes (shared/single user). Also, ensure that you are using Databricks Runtime (DBR) version 10.4 or higher. Also, please note that you need to have the USE CATALOG permission on the main catalog by default and CREATE TABLE permission on the schema you're using.

View solution in original post

2 REPLIES 2

Tharun-Kumar
Honored Contributor II
Honored Contributor II

@drii_cavalcanti 

From the error, we could see that you do not have permission to use the catalog. I suppose you are using Unity Catalog. You should 3 levels of permissions to access the Catalog, schema and then tables.

You can refer to this document - https://docs.databricks.com/en/data-governance/unity-catalog/manage-privileges/privileges.html, which explains how to provide access to the catalog, schema and table.

Kaniz
Community Manager
Community Manager

Hi @drii_cavalcantiThe error you're encountering is related to the new USAGE privilege that is enforced on Databricks clusters running Databricks Runtime 7.3 LTS and above. This privilege is required to access an object in the database. To resolve this issue, you need to grant the USAGE privilege to your user. You can do this by logging into the workspace as an admin user, opening a notebook, and running the following command:

sql
GRANT USAGE ON DATABASE <databasename> TO <user-group>;

Replace <databasename> with the name of your database and <user-group> with your user or group name.If this doesn't solve your issue, you may need to check if the workspace has Unity Catalog metastore attached and if the cluster has UC-supported cluster access modes (shared/single user). Also, ensure that you are using Databricks Runtime (DBR) version 10.4 or higher. Also, please note that you need to have the USE CATALOG permission on the main catalog by default and CREATE TABLE permission on the schema you're using.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.