fix(clickhouse): re-raise non-NOT_IMPLEMENTED errors from EXCHANGE TABLES - #6105
wolfgang-aura wants to merge 3 commits into
Conversation
…BLES _exchange_tables caught every DatabaseError and acted only on NOT_IMPLEMENTED, so any other failure was dropped and a FULL model reported success over stale data. Fixes SQLMesh#6087 Signed-off-by: wolfgang-aura <169568318+wolfgang-aura@users.noreply.github.com>
There was a problem hiding this comment.
The production fix looks correct: unexpected exchange errors now propagate, while the existing NOT_IMPLEMENTED fallback is preserved.
One nonblocking test simplification: the overwrite-level regression already exercises the real _exchange_tables implementation and catches the swallowed error, plus verifies cleanup. Could we consolidate around that test instead of repeating the same failure at the helper level?
Keep the error-propagation assertion, assert no rename occurs, and verify that the only table dropped across the entire execution trace is the temporary table. Please leave the existing NOT_IMPLEMENTED fallback test intact.
Additionally, please confirm that you ran make style and make fast-test locally
…e-level test Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks. Pushed a test-only change on top of your merge commit. The helper-level I ran |
Description
Fixes #6087.
ClickhouseEngineAdapter._exchange_tablescaught everyDatabaseErrorfromEXCHANGE TABLESand only acted onNOT_IMPLEMENTED. Any other error, such asACCESS_DENIED, was dropped._insert_overwrite_by_conditionthen dropped the temp table in itsfinallyand reported success while the target kept its old data.The
exceptblock now re-raises unless the error containsNOT_IMPLEMENTED, as proposed in the issue. The non-atomic rename fallback moves out one indent level; its statements are the same, andtest_exchange_tablescovers that path.Test Plan
Following the test plan in the issue thread, in
tests/core/engine_adapter/test_clickhouse.py:test_exchange_tables_reraises_other_errors:executeraises anACCESS_DENIEDDatabaseError. The test asserts it propagates and that only theEXCHANGE TABLEScall ran (noRENAME, no throwaway-tableDROP).test_insert_overwrite_by_condition_replace_exchange_error_propagates: on the non-partitioned replace path, the exchange raises. The test asserts the error leaves_insert_overwrite_by_conditionand the temp table is still dropped by thefinally.test_exchange_tables(theNOT_IMPLEMENTEDfallback) is not edited and passes in the same run.Both new tests fail on unpatched
main(2 failed, 34 passed) and pass with the fix (36 passed).ruff checkandruff format --checkpass on both files.mypyreports nothing new on them compared withmain.make fast-testwas not run.Checklist
make styleand fixed any issuesmake fast-test)git commit -s) per the DCOWritten with Claude (
claude-sonnet-5-5) and reviewed by a second Claude instance under the Mailman harness.