Snowflake destination does not respect compound primary_key
in MERGE
statements (merge
upsert
strategy); also implements merge_key
in delete-insert
mode in an unexpected way
#2320
Labels
wontfix
This will not be worked on
dlt version
1.5.0
Describe the problem
https://dlthub-community.slack.com/archives/C04DQA7JJN6/p1739564309666949
Snowflake destination does not respect compound
primary_key
inMERGE
statements generated byincremental
merge
upsert
strategy. Instead, it just defaults to using only the primary key fromsql_table()
source inMERGE
expressionExample:
is generated in Snowflake destination when pipeline is configured as:
Snowflake destination also produces unexpected behavior when using
incremental
merge
delete-insert
strategy with compoundmerge_key
.DELETE
statements in destinationOR
together the join condition for theprimary_key
(which, as mentioned above, it seems I'm not able to set), with an additional join condition produced by the compoundmerge_key
configExample:
is generated in Snowflake destination when pipeline is configured as:
Expected behavior
sql_table()
source with Snowflake destination configured as below:should produce the following join condition in generated Snowflake
MERGE
statement:sql_table()
source with Snowflake destination configured as below:should produce the following join condition in generated Snowflake
DELETE
statementColumns which are part of both the
primary_key
andmerge_key
should only be considered once in join condition, and neverOR
'd togetherSteps to reproduce
Unsure how to reproduce as I do not have a public Snowflake instance where I can demonstrate the behavior, but the snippets above should get most of the way there
Operating system
Linux
Runtime environment
Docker, Docker Compose
Python version
3.10
dlt data source
sql_table()
dlt destination
Snowflake
Other deployment details
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: