cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
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
Databricks Employee
Databricks Employee

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
Databricks Employee
Databricks Employee

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!

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group