Skip to content

[Feature] Adding WHERE codintion during MERGE update #56

@philiphagglund

Description

@philiphagglund

Hi,

It would be nice to be able to controll the incremental merge strategy by adding a WHERE clause to the WHEN MATCHED THEN part of the merge statement. As i see on dbt-oracle github it seems the adapter doesn't support it.

ON (src.id = tgt.id AND src.date = tgt.date)
WHEN MATCHED THEN
    UPDATE SET
        tgt.end_date = src.end_date
    WHERE
        src.end_date <> tgt.end_date
WHEN NOT MATCHED THEN
    INSERT (tgt.id, tgt.date, tgt.end_date)
    VALUES (src.id, src.date, src.end_date)

I got recommended by #db-oracle on dbt slack to raise a feature request so it gets tracked.

Describe alternatives you've considered

This is the repons i got from #db-oracle slack channel from @aosingh:

dbt-oracle implements the functionality conforming to the standard defined by dbt.
However, I see that you need support for an arbitrary where clause condition during MERGE update. We will need to think about the interface to implement this. One way could be to introduce a dbt-oracle specific parameter. The challenge is to make this a generic config which can work for any where condition. The where condition can be on the target data or source data or both.
You can also raise a feature request here - https://github.com/oracle/dbt-oracle/issues so that this gets tracked

Who will this benefit?

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions