How to read sql file from a Repo to string

pabloaus
New Contributor III

I am trying to read a sql file in the repo to string. I have tried

with open("/Workspace/Repos/xx@***.com//file.sql","r") as queryFile:
   queryText = queryFile.read()

And I get following error.

[Errno 1] Operation not permitted: '/Workspace/Repos/***@***.com//file.sql'

Senthil1
Databricks Partner

Hi @pablous,

Make sure your REPOS is enabled by checking in Admin console and have full read/list privileges to do from workspace.

If all are perfect, then need to check whether there is anything blocks when we enable Unity Catalog, but i didn't feel anything related to this, since you r hitting GIT integrated repo acess, not the METASTORE repo access

View solution in original post

Senthil1
Databricks Partner

I checked in my unity_catalog enabled cluster, i am able to access the @repos file to read and display