You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/concepts/models/overview.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -507,11 +507,15 @@ Some properties are only available in specific model kinds - see the [model conf
507
507
: Set this to true to indicate that all changes to this model should be [forward-only](../plans.md#forward-only-plans).
508
508
509
509
### on_destructive_change
510
-
: What should happen when a change to a [forward-only model](../../guides/incremental_time.md#forward-only-models) or incremental model in a [forward-only plan](../plans.md#forward-only-plans) causes a destructive modification to the table schema (i.e., requires dropping an existing column).
510
+
: What should happen when a change to a [forward-only model](../../guides/incremental_time.md#forward-only-models) or incremental model in a [forward-only plan](../plans.md#forward-only-plans) causes a destructive modification to the table schema (i.e., requires dropping an existing column or modifying column constraints in ways that could cause data loss).
511
511
512
512
SQLMesh checks for destructive changes at plan time based on the model definition and run time based on the model's underlying physical tables.
513
513
514
-
Must be one of the following values: `allow`, `warn`, or `error` (default).
514
+
Must be one of the following values: `allow`, `warn`, `error` (default), or `ignore`.
515
+
516
+
!!! warning "Ignore is Dangerous"
517
+
518
+
`ignore` is dangerous since it can result in error or data loss. It likely should never be used but could be useful as an "escape-hatch" or a way to workaround unexpected behavior.
515
519
516
520
### disable_restatement
517
521
: Set this to true to indicate that [data restatement](../plans.md#restatement-plans) is disabled for this model.
@@ -78,6 +79,7 @@ Let's unpack this materialization:
78
79
*`query_or_df` - a query (of SQLGlot expression type) or DataFrame (Pandas, PySpark, or Snowpark) instance to be inserted
79
80
*`model` - the model definition object used to access model parameters and user-specified materialization arguments
80
81
*`is_first_insert` - whether this is the first insert for the current version of the model (used with batched or multi-step inserts)
82
+
*`render_kwargs` - a dictionary of arguments used to render the model query
81
83
*`kwargs` - additional and future arguments
82
84
* The `self.adapter` instance is used to interact with the target engine. It comes with a set of useful high-level APIs like `replace_query`, `columns`, and `table_exists`, but also supports executing arbitrary SQL expressions with its `execute` method.
83
85
@@ -150,6 +152,7 @@ class CustomFullMaterialization(CustomMaterialization):
Copy file name to clipboardExpand all lines: docs/guides/incremental_time.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -171,7 +171,12 @@ The check is performed at plan time based on the model definition. SQLMesh may n
171
171
172
172
A model's `on_destructive_change`[configuration setting](../reference/model_configuration.md#incremental-models) determines what happens when SQLMesh detects a destructive change.
173
173
174
-
By default, SQLMesh will error so no data is lost. You can set `on_destructive_change` to `warn` or `allow` in the model's `MODEL` block to allow destructive changes.
174
+
By default, SQLMesh will error so no data is lost. You can set `on_destructive_change` to `warn` or `allow` in the model's `MODEL` block to allow destructive changes.
175
+
`ignore` can be used to not perform the schema change and allow the table's definition to diverge from the model definition.
176
+
177
+
!!! warning "Ignore is Dangerous"
178
+
179
+
`ignore` is dangerous since it can result in error or data loss. It likely should never be used but could be useful as an "escape-hatch" or a way to workaround unexpected behavior.
175
180
176
181
This example configures a model to silently `allow` destructive changes:
0 commit comments