databricks_statement_generator
Render typed diffs into Databricks (Unity Catalog) SQL statements.
Three-level naming: catalog.schema.table. One diff may produce zero, one,
or several ALTER statements depending on the change kind and the number of
delta fields.
AzureDatabricksOptions
¶
Bases: BaseModel
Azure Databricks-specific render-time options grouped by object type.
These options are not tracked in state and are not crawled from the
database. They influence rendering only — currently only the
CREATE TABLE statement (via tables.properties). As a result,
changes to these options apply to newly created objects only; existing
objects are left untouched. Future object groups (views etc.) will
be added as sibling sub-blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tables
|
Options applied to table-creation statements. |
required |
Source code in src/cloe_delta_table_manager/diff/databricks_statement_generator.py
DatabricksStatementGenerator
¶
Render typed diffs to Databricks SQL via in-code match-dispatch.
Unsupported deltas are detected generically: a per-class registry of
handled fields runs as a pre-check before the match dispatch. Any
*Changed diff that touches a field outside its allow-list is reported
as unsupported — no silent no-ops, even for diff types added in the
future. To add support for a new field on an existing *Changed class,
register it in :attr:_HANDLED_CHANGED_FIELDS and extend the renderer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
on_unsupported
|
OnUnsupported
|
|
'fail'
|
Source code in src/cloe_delta_table_manager/diff/databricks_statement_generator.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
__init__(*, on_unsupported='fail', options=None)
¶
Initialize the generator with an unsupported-diff handling mode and options.
Source code in src/cloe_delta_table_manager/diff/databricks_statement_generator.py
generate(diff)
¶
Return the SQL commands for a single diff (zero, one, or many).
Source code in src/cloe_delta_table_manager/diff/databricks_statement_generator.py
TableOptions
¶
Bases: BaseModel
Render-time options that apply to CREATE TABLE statements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
properties
|
Key-value pairs emitted as |
required |
Source code in src/cloe_delta_table_manager/diff/databricks_statement_generator.py
UnsupportedDiffError
¶
Bases: Exception
Raised when a diff has no Databricks SQL representation.
Carries the offending diff so the caller can decide how to surface it.
Source code in src/cloe_delta_table_manager/diff/databricks_statement_generator.py
__init__(diff, reason)
¶
Build the error with the offending diff and a human-readable reason.