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
{{ message }}
Repository navigation
Add support for when_matched expression duckdb engine #4691
Currently, I am running sqlmesh using postgres (+ duckdb) engine. Sqlmesh with postgres engine alone support when_matched expression for INCREMENTAL_BY_UNIQUE_KEY kind, now I plan to use duckdb as execution engine also, but currently the when_matched expression does not supported yet for INCREMENTAL_BY_UNIQUE_KEY duckdb engine. On the other hand, duckdb has upsert statement which more/less similar to merge syntax on postgres I guess. It such a nice feature to use upsert statement to replace merge statement such that when_matched expressions can works also on top of duckdb engine.
changed the title [-]Add support for when_matched expression using INCREMENTAL_BY_UNIQUE_KEY kind with duckdb engine[/-][+]Add support for when_matched expression duckdb engine[/+]on Jun 9, 2025
If we could do this it would be a game changer for us. We use a lot of INCREMENTAL_BY_UNIQUE_KEY and haven't implemented any unit testing yet purely because duckdb doesn't support merge with when_matched.
I'm going to take a look myself to see if I could contribute it.
Activity
[-]Add support for when_matched expression using INCREMENTAL_BY_UNIQUE_KEY kind with duckdb engine[/-][+]Add support for when_matched expression duckdb engine[/+]MikeWallis42 commentedon Jun 27, 2025
If we could do this it would be a game changer for us. We use a lot of INCREMENTAL_BY_UNIQUE_KEY and haven't implemented any unit testing yet purely because duckdb doesn't support merge with when_matched.
I'm going to take a look myself to see if I could contribute it.
MikeWallis42 commentedon Sep 16, 2025
duckdb just release v1.4 which has merge syntax, linking to new ticket #4985
feat(duckdb): use native MERGE for incremental by unique key models