We're using sqlmesh 0.142.2
If we use the IncrementalByUniqueKey kind and specify a when_matched condition, if this is in parenthesis then for each increment that SQLMesh executes we get an additional WHEN NOT MATCHED condition.
This keeps going until Trino throws an internal compiler error because the SQL string is just too long.
It doesn't happen if the when_matched is not in parenthesis.
Locally I changed this line to model.when_matched.copy() and this stopped the problem but feels a bit hacky.
I suspect the issue is because of this append and how long lived the when_matched object is.
I'm guessing it might be related to the fix for this other issue that I raised #3519
We're using sqlmesh 0.142.2
If we use the IncrementalByUniqueKey kind and specify a when_matched condition, if this is in parenthesis then for each increment that SQLMesh executes we get an additional WHEN NOT MATCHED condition.
This keeps going until Trino throws an internal compiler error because the SQL string is just too long.
It doesn't happen if the when_matched is not in parenthesis.
Locally I changed this line to
model.when_matched.copy()and this stopped the problem but feels a bit hacky.I suspect the issue is because of this append and how long lived the when_matched object is.
I'm guessing it might be related to the fix for this other issue that I raised #3519