Problem
When you try to execute a query using SELECT * FROM <table-name>
, the query fails with the following error message.
[UC_DEPENDENCY_DOES_NOT_EXIST] Dependency does not exist in Unity Catalog: Table <catalog.schema.table> is invalid because one of the underlying resources does not exist.SQLSTATE: 42P01
You receive the error whether running the query in a notebook or the SQL editor, and regardless of compute configuration or Databricks Runtime version.
Cause
The table has one or more column-level data masking policies applied using masking functions.
If any of these masking functions have been deleted or are no longer available in the Unity Catalog, the query fails because the table metadata still references the missing functions. Unity Catalog enforces dependency tracking, and when a dependent resource (in this case, a masking function) is removed, any object relying on it becomes invalid.
Solution
Ensure that all masking functions referenced by the table’s columns are present and accessible in the Unity Catalog. Before dropping or modifying a masking function, check whether it is currently in use by existing tables by querying the INFORMATION_SCHEMA.COLUMN_MASKS
system table in the Unity Catalog.
Further, avoid deleting masking functions that are still in use by existing tables. If a masking function is deleted or moved, either recreate it with the same signature or remove the masking policy from the affected columns before running queries.
For details, review the COLUMN_MASKS
(AWS | Azure | GCP) documentation.