fix(clickhouse): remove _mutate_label workaround and bump clickhouse-connect to >=0.13.0 (#38280)

This commit is contained in:
Joe Spadola
2026-02-26 16:12:54 -08:00
committed by GitHub
parent 6589ee48f9
commit bb6ee9e722
5 changed files with 15 additions and 40 deletions

View File

@@ -24,6 +24,10 @@ assists people when migrating to a new version.
## Next
### ClickHouse minimum driver version bump
The minimum required version of `clickhouse-connect` has been raised to `>=0.13.0`. If you are using the ClickHouse connector, please upgrade your `clickhouse-connect` package. The `_mutate_label` workaround that appended hash suffixes to column aliases has also been removed, as it is no longer needed with modern versions of the driver.
### MCP Tool Observability
MCP (Model Context Protocol) tools now include enhanced observability instrumentation for monitoring and debugging:

View File

@@ -751,14 +751,14 @@
"OPEN_SOURCE"
],
"pypi_packages": [
"clickhouse-connect>=0.6.8"
"clickhouse-connect>=0.13.0"
],
"connection_string": "clickhousedb://{username}:{password}@{host}:{port}/{database}",
"default_port": 8123,
"drivers": [
{
"name": "clickhouse-connect (Recommended)",
"pypi_package": "clickhouse-connect>=0.6.8",
"pypi_package": "clickhouse-connect>=0.13.0",
"connection_string": "clickhousedb://{username}:{password}@{host}:{port}/{database}",
"is_recommended": true,
"notes": "Official ClickHouse Python driver with native protocol support."
@@ -781,7 +781,7 @@
"connection_string": "clickhousedb://localhost/default"
}
],
"install_instructions": "echo \"clickhouse-connect>=0.6.8\" >> ./docker/requirements-local.txt",
"install_instructions": "echo \"clickhouse-connect>=0.13.0\" >> ./docker/requirements-local.txt",
"compatible_databases": [
{
"name": "ClickHouse Cloud",
@@ -794,7 +794,7 @@
"HOSTED_OPEN_SOURCE"
],
"pypi_packages": [
"clickhouse-connect>=0.6.8"
"clickhouse-connect>=0.13.0"
],
"connection_string": "clickhousedb://{username}:{password}@{host}:8443/{database}?secure=true",
"parameters": {
@@ -816,7 +816,7 @@
"HOSTED_OPEN_SOURCE"
],
"pypi_packages": [
"clickhouse-connect>=0.6.8"
"clickhouse-connect>=0.13.0"
],
"connection_string": "clickhousedb://{username}:{password}@{host}/{database}?secure=true",
"docs_url": "https://docs.altinity.com/"

View File

@@ -120,7 +120,7 @@ bigquery = [
"sqlalchemy-bigquery>=1.15.0",
"google-cloud-bigquery>=3.10.0",
]
clickhouse = ["clickhouse-connect>=0.5.14, <1.0"]
clickhouse = ["clickhouse-connect>=0.13.0, <1.0"]
cockroachdb = ["cockroachdb>=0.3.5, <0.4"]
crate = ["sqlalchemy-cratedb>=0.40.1, <1"]
d1 = [

View File

@@ -42,7 +42,6 @@ from superset.db_engine_specs.exceptions import SupersetDBAPIDatabaseError
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
from superset.extensions import cache_manager
from superset.utils.core import GenericDataType
from superset.utils.hashing import hash_from_str
from superset.utils.network import is_hostname_valid, is_port_open
if TYPE_CHECKING:
@@ -288,13 +287,13 @@ class ClickHouseConnectEngineSpec(BasicParametersMixin, ClickHouseEngineSpec):
DatabaseCategory.ANALYTICAL_DATABASES,
DatabaseCategory.OPEN_SOURCE,
],
"pypi_packages": ["clickhouse-connect>=0.6.8"],
"pypi_packages": ["clickhouse-connect>=0.13.0"],
"connection_string": "clickhousedb://{username}:{password}@{host}:{port}/{database}",
"default_port": 8123,
"drivers": [
{
"name": "clickhouse-connect (Recommended)",
"pypi_package": "clickhouse-connect>=0.6.8",
"pypi_package": "clickhouse-connect>=0.13.0",
"connection_string": (
"clickhousedb://{username}:{password}@{host}:{port}/{database}"
),
@@ -330,7 +329,7 @@ class ClickHouseConnectEngineSpec(BasicParametersMixin, ClickHouseEngineSpec):
},
],
"install_instructions": (
'echo "clickhouse-connect>=0.6.8" >> ./docker/requirements-local.txt'
'echo "clickhouse-connect>=0.13.0" >> ./docker/requirements-local.txt'
),
"compatible_databases": [
{
@@ -347,7 +346,7 @@ class ClickHouseConnectEngineSpec(BasicParametersMixin, ClickHouseEngineSpec):
DatabaseCategory.CLOUD_DATA_WAREHOUSES,
DatabaseCategory.HOSTED_OPEN_SOURCE,
],
"pypi_packages": ["clickhouse-connect>=0.6.8"],
"pypi_packages": ["clickhouse-connect>=0.13.0"],
"connection_string": (
"clickhousedb://{username}:{password}@{host}:8443/{database}?secure=true"
),
@@ -372,7 +371,7 @@ class ClickHouseConnectEngineSpec(BasicParametersMixin, ClickHouseEngineSpec):
DatabaseCategory.CLOUD_DATA_WAREHOUSES,
DatabaseCategory.HOSTED_OPEN_SOURCE,
],
"pypi_packages": ["clickhouse-connect>=0.6.8"],
"pypi_packages": ["clickhouse-connect>=0.13.0"],
"connection_string": (
"clickhousedb://{username}:{password}@{host}/{database}?secure=true"
),
@@ -518,17 +517,6 @@ class ClickHouseConnectEngineSpec(BasicParametersMixin, ClickHouseEngineSpec):
]
return []
@staticmethod
def _mutate_label(label: str) -> str:
"""
Suffix with the first six characters from the md5 of the label to avoid
collisions with original column names
:param label: Expected expression label
:return: Conditionally mutated label
"""
return f"{label}_{hash_from_str(label)[:6]}"
@classmethod
def adjust_engine_params(
cls,

View File

@@ -212,23 +212,6 @@ def test_connect_get_column_spec(
assert_column_spec(spec, native_type, sqla_type, attrs, generic_type, is_dttm)
@pytest.mark.parametrize(
"column_name,expected_result",
[
# SHA-256 hash suffix (first 6 chars) with default HASH_ALGORITHM
("time", "time_336074"),
("count", "count_6c3549"),
],
)
def test_connect_make_label_compatible(column_name: str, expected_result: str) -> None:
from superset.db_engine_specs.clickhouse import (
ClickHouseConnectEngineSpec as spec, # noqa: N813
)
label = spec.make_label_compatible(column_name)
assert label == expected_result
@pytest.mark.parametrize(
"schema, expected_result",
[