Repository navigation
fix(clickhouse): respect user-provided insert_quorum in cluster mode - #6190
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
In cluster/cloud mode the ClickHouse connection always overwrote insert_quorum with "auto", ignoring a value set in connection_settings. It also mutated the user's connection_settings dict in place. Use setdefault so a user-provided insert_quorum wins, and work on a copy of the settings dict. Fixes SQLMesh#6171 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Alex Castillo <alex.castillog33@gmail.com>
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.
Fixes #6171
Description
In
ClickhouseConnectionConfig._static_connection_kwargs, cluster/cloud mode unconditionally assignedsettings["insert_quorum"] = "auto", overwriting anyinsert_quorumset inconnection_settings(which #6171 shows can silently lose data in the insert-overwrite path).settingswas also the user's own dict (self.connection_settings or {}), so the assignment mutated it in place.The fix copies the dict and uses
setdefault("insert_quorum", "auto"):autostays the default in cluster mode, but a user-provided value wins.Test Plan
Added
test_clickhouse_insert_quorum_user_settingintests/core/test_connection_config.py: a userinsert_quorumis kept in cluster mode, the user's dict is not mutated, and the default is stillautowhen unset. It fails onmain('auto' == '0') and passes with the change; the other ClickHouse connection tests in that file pass too.make fast-testwas not run in full (optional database drivers were not installed).Checklist
make styleand fixed any issues (ruff checkandruff format --checkpass on the changed files)make fast-test)git commit -s) per the DCOThis change was prepared with the help of an AI assistant (Claude Code), and the author is responsible for the change.
🤖 Generated with Claude Code
Summary by CodeRabbit
insert_quorumvalue and apply the"auto"default for cluster connections only when no value is set.