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/model_kinds.md
+28-1
Original file line number
Diff line number
Diff line change
@@ -1552,4 +1552,31 @@ Depending on the target engine, models of the `INCREMENTAL_BY_PARTITION` kind ar
1552
1552
| BigQuery | DELETE by partitioning key, then INSERT |
1553
1553
| Redshift | DELETE by partitioning key, then INSERT |
1554
1554
| Postgres | DELETE by partitioning key, then INSERT |
1555
-
| DuckDB | DELETE by partitioning key, then INSERT |
1555
+
| DuckDB | DELETE by partitioning key, then INSERT |
1556
+
1557
+
## INCREMENTAL_UNMANAGED
1558
+
1559
+
The `INCREMENTAL_UNMANAGED` model kind exists to support append-only tables. It's "unmanaged" in the sense that SQLMesh doesnt try to manage how the data is loaded. SQLMesh will just run your query on the configured cadence and append whatever it gets into the table.
1560
+
1561
+
!!! question "Should you use this model kind?"
1562
+
1563
+
Some patterns for data management, such as Data Vault, may rely on append-only tables. In this situation, `INCREMENTAL_UNMANAGED` is the correct type to use.
1564
+
1565
+
In most other situations, you probably want `INCREMENTAL_BY_TIME_RANGE` or `INCREMENTAL_BY_UNIQUE_KEY` because they give you much more control over how the data is loaded.
1566
+
1567
+
Usage of the `INCREMENTAL_UNMANAGED` model kind is straightforward:
1568
+
1569
+
```sql linenums="1" hl_lines="3"
1570
+
MODEL (
1571
+
name db.events,
1572
+
kind INCREMENTAL_UNMANAGED,
1573
+
);
1574
+
```
1575
+
1576
+
Since it's unmanaged, it doesnt support the `batch_size` and `batch_concurrency` properties to control how data is loaded like the other incremental model types do.
1577
+
1578
+
!!! warning "Only full restatements supported"
1579
+
1580
+
Similar to `INCREMENTAL_BY_PARTITION`, attempting to [restate](../plans.md#restatement-plans) an `INCREMENTAL_UNMANAGED` model will trigger a full restatement. That is, the model will be rebuilt from scratch rather than from a time slice you specify.
1581
+
1582
+
This is because an append-only table is inherently non-idempotent. Restating `INCREMENTAL_UNMANAGED` models may lead to data loss and should be performed with care.
0 commit comments