sqlmesh icon indicating copy to clipboard operation
sqlmesh copied to clipboard

When matched ambiguous name

Open MikeWallis42 opened this issue 7 months ago • 5 comments

I tried to use the when_matched configuration property to add a condition but the target placeholder wasn't substituted. If we take the structure of the example you provide then it could look something like this.

when_matched WHEN MATCHED AND source.salary <> target.salary THEN UPDATE SET target.salary = COALESCE(source.salary, target.salary)

which resolves to the below for Trino

WHEN MATCHED AND "__merge_source__"."salary" <> "salary" THEN UPDATE SET ...

I think perhaps this is an exception where each side of the comparator needs qualifying but then the update statement does not.

I plan to use this to compare a fingerprint for each row so that I can eliminate false positive updates for end users.

MikeWallis42 avatar Jul 24 '24 13:07 MikeWallis42