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

Unable to query Unity Catalog tables from notebooks.

animadurkar
New Contributor III

In my workspace, I'm able to see the unity catalogs my team has created. I'm able to see the schemas and even query data in there and create views using the SQL Editor.

When I go to write the same sql queries from a notebook using spark.sql or %sql I get this error:

AnalysisException: [UC_NOT_ENABLED] Unity Catalog is not enabled on this cluster.

I reviewed my cluster and it is a:

  • Databricks ML 13.0 Runtime
  • Access Mode is Single User
  • Personal Compute Policy

I'm unsure why this is the case, especially if I can access it normally outside of the notebook. Does anyone have ways to fix this?

1 ACCEPTED SOLUTION

Accepted Solutions

animadurkar
New Contributor III

Figured it out. Had to just delete my personal cluster (which was created before the unity metastore was set up) and recreate it. Then if you run "USE CATALOG my_catalog;" before your queries in your notebook, it works great.

View solution in original post

6 REPLIES 6

animadurkar
New Contributor III

Figured it out. Had to just delete my personal cluster (which was created before the unity metastore was set up) and recreate it. Then if you run "USE CATALOG my_catalog;" before your queries in your notebook, it works great.

had a similar issue earlier.. thanks for the solution..

Ajay-Pandey
Esteemed Contributor III

Hi @Ani Madurkar​ ,

It's required that the cluster you are using should have unity catalog enabled then you will be able to query your catalog.

#DAIS2023​ 

image.pngimage.png

youssefmrini
Honored Contributor III
Honored Contributor III

You need to make sure that in the cluster you are using you have the Unity Catalog tag. Then in the notebook add the use catalog ..... after this you will be able to query your table if you have the permission.

Anonymous
Not applicable

Hi @Ani Madurkar​ 

Thank you for posting your question in our community! We are happy to assist you.

To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?

This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance! 

Thanks! just did

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.