Auto-detect ClickHouse Cloud secure connections#541
Merged
Conversation
ClickHouse Cloud blocks port 9000 (plaintext native protocol), only accepting connections on port 9440 (native + TLS). Users connecting via DataStore hit NO_REMOTE_SHARD_AVAILABLE because the default is remote() on port 9000. Mirror the auto-detection logic from clickhouse-client (PRs #56638, #56649, #74212): - .clickhouse.cloud hosts -> secure=True + default port 9440 - Port 9440 on any host -> secure=True - Support ?secure=true in clickhouse:// URIs
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.
Summary
.clickhouse.cloudhosts and default toremoteSecure()on port 9440, mirroring clickhouse-client behaviorsecure=Truewhen port 9440 is specified (mirrors PR #74212)?secure=truesupport inclickhouse://URIs.clickhouse.cloud:9000→:9440Fixes the
NO_REMOTE_SHARD_AVAILABLEerror users hit when connecting to ClickHouse Cloud without explicitly settingsecure=True+ port 9440.Changes
datastore/adapters.pynormalize_clickhouse_connection()helper, call it inClickHouseAdapter.__init__datastore/core.py_remote_paramsfor ClickHouse sourcesdatastore/table_functions.pyRemoteTableFunction.to_sql()datastore/uri_parser.py?secure=truequery parameter inclickhouse://URIsTest plan
test_remote_connection.py(cloud host, port rewrite, warning log, adapter SQL)test_table_functions.py(RemoteTableFunction auto-detection)test_uri_parser.py(?secure=true/1/false, absent)