fix(clickhouse): re-raise non-NOT_IMPLEMENTED errors from EXCHANGE TABLES - #6105
Open
wolfgang-aura wants to merge 1 commit into
Open
wolfgang-aura wants to merge 1 commit into
wolfgang-aura wants to merge 1 commit 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 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.