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

is there a read only option in jdbc driver?

624398
New Contributor III

Is there a "read only" option when using databricks sql using jdbc driver?

I'm looking for an equivalent to this:

https://docs.aws.amazon.com/redshift/latest/mgmt/jdbc20-configuration-options.html#jdbc20-readonly-o...

Thanks!

7 REPLIES 7

Debayan
Esteemed Contributor III
Esteemed Contributor III

Hi, You can refer to https://docs.databricks.com/external-data/jdbc.html#read-data-with-jdbc

Please let us know if this helps. 

Also please tag @Debayan​ with your next response which will notify me, Thank you!

624398
New Contributor III

@Debayan Mukherjee​ Thanks for your reply - but I don't think this help my case:

I want to let my app's users to be able to query over my databricks sql server, with prevention of editing data.

Statements like drop, insert, delete, update, truncate, etc... should not be allowed in that context.

Perhaps I did not fully understand your suggestion...

Thanks!

Anonymous
Not applicable

@Nativ Issac​ I would suggest to use a PAT token created on behalf of a service principal and grant SELECT privilege only to the service principal to the targeted catalogs/schemas/tables. Thus you can restrict the access to the data using JDBC. Please refer to below docs on the same topic. Hope this helps.

https://docs.databricks.com/dev-tools/api/latest/token-management.html#operation/get-token

https://docs.databricks.com/data-governance/unity-catalog/manage-privileges/privileges.html

https://docs.databricks.com/archive/spark-sql-2.x-language-manual/grant.html

Vartika
Moderator
Moderator

Hi @Nativ Issac​ 

Hope everything is going great.

Just wanted to check in if you were able to resolve your issue. If yes, would you be happy to mark an answer as best so that other members can find the solution more quickly? If not, please tell us so we can help you. 

Cheers!

624398
New Contributor III

Hello @Vartika Nain​ ,

Still struggling with this

Anonymous
Not applicable

@Nativ Issac​ 

Have you tried these steps?

  1. Create service principal
  2. Create a PAT token on behalf of the service of the service principal.
  3. Grant only READ privileges to the service principal on all catalogs.
  4. Use the service principal token to access the tables in JDBC

624398
New Contributor III

Hello @John Lourdu​ 

Thanks for your reply!

Unfortunately, for my project purposes, I can't do your suggested solution:

The project I'm working on is getting credentials of a customer databricks sql server and can not create service accounts etc...

Getting the customer do your solution is not the best option for me: it's a large company so every interaction is a hassle in terms of bureaucracy and politics..

Therefore I'm looking for a software solution.

Hope we can figure this out..

Thanks!

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.