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: 

pyodbc read only connection.

Orianh
Valued Contributor II

Hey Guys,

Is there a way to open pyodbc read only connection with simba spark driver?

At the moment, I'm able to execute queries such as select , delete, insert into - basically every sql statement using pyodbc.

I tried to open pyodbc connection but only with read permissions which means the user won't be able to delete/ create/ change any table - just read data from it. but didn't succeed.

I tried open connections in this way:

con  = pyodbc.connect(connection_string, autocommit=True, readonly=True)

Is there a built in way already? Or I must check the query that i have been asked to execute?

Hope you can help me,

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Hubert-Dudek
Esteemed Contributor III

This readonly=True is working only on some drivers. Just create additional users with granted read-only permission.

View solution in original post

2 REPLIES 2

Hubert-Dudek
Esteemed Contributor III

This readonly=True is working only on some drivers. Just create additional users with granted read-only permission.

Orianh
Valued Contributor II

Thanks, I saw in pyodbc issues that not all drivers support it too.

But wanted to ask just to be sure.!

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!