Supported operations¶
dtm renders typed diffs into Databricks (Unity Catalog) SQL via
DatabricksStatementGenerator.
Anything not listed below surfaces as UnsupportedDiffError in fail mode
(default) or is dropped in skip mode.
All statements use three-level naming: catalog.schema.table.
Schema operations¶
| # | Operation | Diff type | SQL emitted |
|---|---|---|---|
| 1 | Create schema | SchemaAdded |
CREATE SCHEMA IF NOT EXISTS {catalog}.{schema}; |
| 2 | Drop schema | SchemaRemoved |
DROP SCHEMA IF EXISTS {catalog}.{schema} CASCADE; |
SchemaChanged has no handled fields — any modification is unsupported.
Table operations¶
| # | Operation | Diff type | SQL emitted |
|---|---|---|---|
| 3 | Create table | TableAdded |
CREATE TABLE IF NOT EXISTS {catalog}.{schema}.{table} (<columns>[, PRIMARY KEY (<pk>)]); |
| 4 | Drop table | TableRemoved |
DROP TABLE IF EXISTS {catalog}.{schema}.{table}; |
Create-table inlines column definitions (type, NOT NULL, DEFAULT, COMMENT)
and a composite PRIMARY KEY clause when any column has is_key=true.
TableChanged has no handled fields.
Column operations¶
| # | Operation | Trigger (field delta) | SQL emitted |
|---|---|---|---|
| 5 | Add column | ColumnAdded |
ALTER TABLE … ADD COLUMN <col_def>; |
| 6 | Drop column | ColumnRemoved |
ALTER TABLE … DROP COLUMN IF EXISTS <name>; |
| 7 | Change type | data_type, data_type_length, data_type_precision, data_type_numeric_scale |
ALTER TABLE … ALTER COLUMN <name> TYPE <new_type>; |
| 8 | Set NOT NULL | is_nullable: true → false |
ALTER TABLE … ALTER COLUMN <name> SET NOT NULL; |
| 9 | Drop NOT NULL | is_nullable: false → true |
ALTER TABLE … ALTER COLUMN <name> DROP NOT NULL; |
| 10 | Set / change comment | comment |
ALTER TABLE … ALTER COLUMN <name> COMMENT '<new>'; |
| 11 | Drop comment | comment: <any> → null |
ALTER TABLE … ALTER COLUMN <name> COMMENT NULL; |
| 12 | Set / change default | constraints (non-null) |
ALTER TABLE … ALTER COLUMN <name> SET DEFAULT <expr>; |
| 13 | Drop default | constraints: <any> → null |
ALTER TABLE … ALTER COLUMN <name> DROP DEFAULT; |
| 14 | Add primary key | is_key: false/null → true |
ALTER TABLE … ADD CONSTRAINT pk_<table> PRIMARY KEY (<name>); |
| 15 | Drop primary key | is_key: true → false/null |
ALTER TABLE … DROP PRIMARY KEY; |
A single ColumnChanged diff can emit several ALTER statements — one per
field delta. Field deltas outside the allow-list above raise
UnsupportedDiffError.
Type-change detection compares the rendered type string (int, decimal(18,
2), string), so crawler artifacts like precision=0, scale=0 on an INT
column don't produce spurious ALTERs.
Catalog operations¶
Not supported. dtm never emits CREATE, ALTER, or DROP CATALOG. See
scope for the rationale.
Renames¶
Not detected in v1. A rename surfaces as Removed + Added.
Known limitations¶
- Column drops require column-mapping mode. Databricks requires
delta.columnMapping.mode = 'name'on the target table before anyDROP COLUMNsucceeds. Configure it once inproject.yamlunderplatform_options.tables.properties— dtm then emits it on everyCREATE TABLE. Note that this only covers newly created tables; for existing tables, set the property via a pre-deployment migration. - Single-column PK only when toggled via
is_key. Composite primary keys are only emitted onCREATE TABLE. Togglingis_keyon an existing column generates a single-column PK constraint.