Skip to content

Add support for when_matched expression duckdb engine #4691

Open

Description

@maulanaady

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.

Activity

  1. 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
  2. MikeWallis42 commented on Jun 27, 2025

    @MikeWallis42
    Contributor

    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.

  3. MikeWallis42 commented on Sep 16, 2025

    @MikeWallis42
    Contributor

    duckdb just release v1.4 which has merge syntax, linking to new ticket #4985

  4. added a commit that references this issue on Nov 15, 2026
    84af4c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions