Repository navigation
fix(db): don't abort ClickHouse table listing on an unparsable version - #1546
Open
borealisalastor-byte wants to merge 1 commit into
Open
borealisalastor-byte wants to merge 1 commit into
borealisalastor-byte wants to merge 1 commit into
Conversation
get_version() returns '' whenever the version query fails (limited
permissions, timeout, pool error), and the ClickHouse branch called
int(db_version.split('.')[0]) on it, so table listing raised ValueError
before any SQL was built. A non-numeric prefix behaved the same way.
Parse the leading number and fall back to the pre-22 query when there is
none; '"" as comment' is valid on every ClickHouse version, and the
branch that needs the real comment column only runs when a version is
actually known.
This branch has not been deployed
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.
What breaks
get_table_sql()for a ClickHouse datasource doesint(db_version.split('.')[0])to decide whethersystem.tableshas acommentcolumn.get_version()returns''whenever the version query fails — limited permissions, a timeout, a pool error — and the ClickHouse version string may also arrive with a non-numeric prefix. In both cases table listing raisedValueErrorbefore any SQL was built, so datasource table sync / embedding failed instead of degrading.Reproduced against
287935a6by loading the function in isolation:Change
leading_version()parses the leading number and returns 0 when there is none.'' as commentprojection is valid on every ClickHouse release; the branch that needs the real comment column only runs when a version is actually known.backend/tests/test_ck_table_sql_version.pycovers'',None,'v23.8','unknown'and blank strings, keeps 22+/21- selection intact, and pinsleading_version(). It loads onlyget_table_sql/leading_versionvia AST, like the existing isolated tests, so no driver stack is needed.Verification
python -m pytest tests/test_ck_table_sql_version.py -q: 10 passed (local, Python 3.13).287935a6for the unparsable inputs (ValueError shown above).