Use Unity Catalog (Project)
Applies to
Platform: Databricks
Use Unity Catalog (UseUnityCatalog, formerly Unity Catalog) decides whether Databricks objects are created in Unity Catalog or in the Hive metastore. It changes the object names, the deployment headers and the constraints.
Databricks dbt does not offer the property.
Values and default
Set the value in the Implementation group of the Additional Settings in Project Settings:
true(default): objects are namedcatalog.schema.object.false: objects are nameddatabase.objectin the Hive metastore.
Effect on generated output
- Layer header:
CREATE SCHEMA IF NOT EXISTSwithtrue,CREATE DATABASE IF NOT EXISTSwithfalse. - Primary keys and unique constraints: declared only with
true. - Foreign keys: declared
NOT ENFORCEDonly withtrue. - Placeholder
database_name:datalakehousewithtrue, the layer name withfalse. - Placeholder
schema_name: the layer name withtrue, empty withfalse.
The layer header creates the schema only when the Deployment Options contain Generate Create Schema If Not Exists Statements; the database statement with false does not depend on them. With false, the replacement configuration also has a database_directory placeholder for the location of each database. replace_placeholders.ps1 removes the empty schema together with its dot from the object names. Apply Sensitivity Level Tags has an effect only with true.
Example
The Raw Vault header of a Data Vault project with true (line breaks added):
spark.sql('CREATE SCHEMA IF NOT EXISTS
`{<project>#rawvault#database_name}`.
`{<project>#rawvault#schema_name}`')
With false:
spark.sql("CREATE DATABASE IF NOT EXISTS
`{<project>#rawvault#database_name}`
LOCATION '{<project>#rawvault#database_directory}'")
Release differences
Up to Generator 1.10 the default was False; since Generator 2.0 it is True.
Related articles
- Reference: Deployment Options (Project), Use Unique Constraints (Project), Foreign Key Mode (Model Object), Databricks Unity - Placeholder values
- See also: Databricks Unity - Target environment, Databricks - Target environment