Commit 9212bba
feat: add
Resolves #703
### Description
Adds a `skip_optimize` model config that lets users opt out of the
post-materialization `OPTIMIZE` call without removing `zorder` /
`liquid_clustered_by` / `auto_liquid_cluster` from the table definition.
**Motivation**: the existing opt-out today is the run-wide
`DATABRICKS_SKIP_OPTIMIZE` var, which forces an all-or-nothing decision
for the entire invocation. Several users in #703 asked for a
config-level opt-out so they can:
- delegate `OPTIMIZE` to Predictive Optimization while keeping
`auto_liquid_cluster=true` on the table
- skip `OPTIMIZE` only for specific high-churn models and let it run for
the rest
- schedule `OPTIMIZE` out of band (workflow / job) instead of on the dbt
critical path
**Behavior**:
- New model config `skip_optimize` (bool, default `false`)
- When truthy, `databricks__optimize` short-circuits to a no-op even if
`zorder` / `liquid_clustered_by` / `auto_liquid_cluster` is set on the
model — the clustering declaration remains in the table DDL, only the
`OPTIMIZE` SQL emission is suppressed
- Inherits via standard dbt config resolution: project → folder → model
(more specific wins). Example:
```yaml
# dbt_project.yml
models:
my_project:
+skip_optimize: true
high_read_models:
+skip_optimize: false
```
- `DATABRICKS_SKIP_OPTIMIZE` var is unchanged (still skips run-wide)
### Docs follow-up
User-facing config reference lives in `dbt-labs/docs.getdbt.com`
(`databricks-configs.md`). A companion docs PR will be opened there to
document `skip_optimize` alongside the existing `zorder` /
`liquid_clustered_by` / `auto_liquid_cluster` entries.
### Checklist
- [x] I have run this code in development and it appears to resolve the
stated issue
- [x] This PR includes tests, or tests are not required/relevant for
this PR
- [x] I have updated the `CHANGELOG.md` and added information about my
change to the "dbt-databricks next" section.
---------
Co-authored-by: Shubham Dhal <shubham.dhal@databricks.com>skip_optimize model config to opt out of post-materialization OPTIMIZE (#1485)1 parent ce47403 commit 9212bba
5 files changed
Lines changed: 34 additions & 2 deletions
File tree
- dbt
- adapters/databricks
- include/databricks/macros/relations
- tests/unit/macros
- relations
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| 208 | + | |
208 | 209 | | |
209 | 210 | | |
210 | 211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
126 | 138 | | |
127 | 139 | | |
128 | 140 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
0 commit comments