QuestionQ56

VerifiedExecuting queries using Databricks SQL and Databricks SQL Warehouses

A data analyst works in a Databricks workspace with Unity Catalog enabled. When using a shared SQL Warehouse, the analyst runs:

SELECT * FROM sales_data;  

The query returns a TABLE_OR_VIEW_NOT_FOUND error, even though:

  • The sales_data table exists in the reporting schema of the corp_data catalog.
  • The analyst has SELECT and USAGE privileges on the corp_data.reporting.sales_data table.
  • Another user who runs the same query in a notebook attached to a cluster can retrieve results without fully qualifying the table.

Which action helps the analyst resolve the issue without rewriting the query?

Explanation

USE CATALOG corp_data sets the session’s current catalog, and USE SCHEMA reporting sets its current schema. Unqualified table names are then resolved within corp_data.reporting, allowing sales_data to be found. Databricks documents that session-level USE CATALOG takes precedence for the current catalog and that the cluster-level spark.databricks.sql.initial.catalog.namespace setting is not available for SQL warehouses.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!