Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix empty "WHEN MATCHED THEN UPDATE SET" clause on "MERGE INTO" #100

Merged
merged 1 commit into from
Sep 20, 2022

Conversation

qrollin
Copy link
Contributor

@qrollin qrollin commented Sep 20, 2022

See our conversation on #96

The stream is just a different way to do the filter and append of columns, the main part being the finishing if conditionally adding the WHEN MATCHED THEN UPDATE SET if there is any column to update.

@qrollin
Copy link
Contributor Author

qrollin commented Sep 20, 2022

I implemented this solution only for SQLServerManager because it is my current concern, but similar behavior can be observed for OracleManager, StandardJDBCManager and OracleManagerCDC.

@osalvador
Copy link
Owner

Hi @qrollin,

Great contribution, thank you very much. Now I understand what you want to do.

However, there is one thing that worries me because this change will cause some source rows in the sink to be ignored, it is true that they will be the ones that may give an error in the merge statement. For the time, an alert will have to be included to indicate this.

Thank you again!

@osalvador osalvador merged commit 151a80e into osalvador:master Sep 20, 2022
@qrollin
Copy link
Contributor Author

qrollin commented Sep 20, 2022

I'm not sure I quite understand what you mean by :

some source rows in the sink to be ignored

because this should only prevent syntax error on the MERGE INTO query generation, in the specific case where the all the source table columns are part of the PK.
Therefore, it should be equivalent to a clause WHEN MATCHED DO NOTHING, so no error raised on merged rows if the PK already exists

@qrollin qrollin deleted the feature/fix_merge_into branch September 20, 2022 14:41
@osalvador
Copy link
Owner

Hi @qrollin,

That is, there are rows that in case of a match will be ignored. This means that we have moved records around the network from source to sink that are not going to persist in the sink. For the time, I will leave a warning in the log.

Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants