โ04-12-2023 07:18 AM
Hi I am trying to use the SQL Merge statement on databricks
MERGE INTO target
USING source
ON source.key = target.key
WHEN MATCHED
UPDATE SET *
WHEN NOT MATCHED
INSERT *
WHEN NOT MATCHED BY SOURCE
DELETE
This is failing with the error [PARSE_SYNTAX_ERROR] Syntax error at or near 'UPDATE'.(line 18, pos 2). I am running my notebook on a cluster that is running Databricks 12.2
Any help is appreciated.
โ04-13-2023 11:11 AM
I was missing the THEN before UPDATE, INSERT and DELETE. This keyword is missing from the documentation on Databricks https://learn.microsoft.com/en-us/azure/databricks/delta/merge
It now works. Thanks
โ04-13-2023 03:10 AM
Are you using the wildcard for the Update and insert ?
#DAIS2023
โ04-13-2023 11:11 AM
I was missing the THEN before UPDATE, INSERT and DELETE. This keyword is missing from the documentation on Databricks https://learn.microsoft.com/en-us/azure/databricks/delta/merge
It now works. Thanks
Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections.
Click here to register and join today!
Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.