Provision a catalog and schemas¶
This tutorial creates a real Unity Catalog catalog and schemas. Use a unique, non-production name.
Live cloud changes
The steps use live-apply. Confirm the target workspace and catalog name
before running apply.
Prerequisites¶
- successful
datamuru doctorinlive-readonly; - permission to create catalogs and schemas;
- a running SQL warehouse and its ID if using Databricks default storage.
Configure the SQL warehouse¶
Set the warehouse ID without storing it in source control:
$env:DATABRICKS_SQL_WAREHOUSE_ID = "replace-with-warehouse-id"
Add the environment variable name to providers/databricks.yml:
provider:
cloud: azure
execution_mode: live-apply
host: https://your-workspace.cloud.databricks.com
auth_type: pat
token_env: DATABRICKS_TOKEN
sql_warehouse_id_env: DATABRICKS_SQL_WAREHOUSE_ID
Declare the catalog¶
workspace:
name: example-dev
cloud: azure
region: eastus2
catalogs:
- name: dm_tutorial_analytics
use_default_storage: true
schemas:
- bronze
- silver
- gold
use_default_storage: true creates the catalog through the Databricks SQL
Statements API. To use explicit cloud storage instead, see
Manage catalogs and schemas.
Diagnose requirements¶
datamuru validate --config datamuru.yml
datamuru doctor --config datamuru.yml
Doctor should report that a SQL warehouse ID is configured for default-storage catalog creation.
Plan the related resources¶
datamuru plan --config datamuru.yml --target catalog:dm_tutorial_analytics
A catalog target includes schemas whose addresses begin with
schema:dm_tutorial_analytics..
Apply¶
datamuru apply --config datamuru.yml --target catalog:dm_tutorial_analytics --auto-approve
Expected result: one catalog and three schemas are applied. DataMuru skips child schemas if catalog creation fails.
Verify¶
- Open Catalog Explorer in Databricks.
- Confirm the catalog and schemas exist.
- Run the plan again.
datamuru plan --config datamuru.yml --target catalog:dm_tutorial_analytics
The second plan should show no required changes.
Clean up¶
Review dependencies before destroying a catalog. DataMuru does not assume that dropping data-bearing resources is safe.
datamuru destroy --config datamuru.yml --target catalog:dm_tutorial_analytics --confirm-destroy