Skip to content

Commit 0eae123

Browse files
eschuthoclaude
andcommitted
fix(clickhouse): chain migration off master head and address review
- Reparent onto master's single head b8f3a2c91d64. #44288 merged the two former parents into e2f3a1b9c640, and several merges have since stacked on top of it, so the old tuple re-forked the graph. - HTTP rows: the legacy driver ignores `secure` and defaults to 8123 even for `protocol=https`, so drop stray `secure` (no duplicates / no silent plaintext->TLS flip) and pin 8123 when `secure=true` is introduced without a port (clickhouse-connect would otherwise pick 8443). - Native rows carrying TLS (`secure=true`) are skipped instead of being pointed at the plaintext HTTP port. - Parameters the drivers don't share (endpoint, timeout, ca_certs, header__*, a CA-path `verify`, ...) are no longer carried verbatim; the row stays on the legacy driver and its id is logged for the operator. - Exact rollback: upgrade records the original URI and a fingerprint of the migrated state in a migration-owned table; downgrade restores only unchanged converted rows, then drops the table (Databricks precedent). - Add `clickhousedb` to DISALLOWED_SQL_FUNCTIONS so the ClickHouse denylist follows rewritten rows. - Document the change in UPDATING.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 91f997c commit 0eae123

4 files changed

Lines changed: 455 additions & 332 deletions

File tree

‎UPDATING.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,21 @@ assists people when migrating to a new version.
5050
destinations. Both policies ignore environment proxies and preserve budgets and
5151
TLS hostname verification. See the [provider transport guide](docs/developer_docs/extensions/semantic-provider-transport.md).
5252

53+
- Saved ClickHouse connections on the legacy `clickhouse://` (clickhouse-sqlalchemy)
54+
driver are migrated to `clickhousedb+connect://` (clickhouse-connect) by
55+
`superset db upgrade`, so they use the dynamic connection form. Install
56+
`clickhouse-connect>=0.13.0` before upgrading. HTTP connections keep their port;
57+
`?protocol=https` becomes `?secure=true` (port 8123 is pinned when none was set).
58+
Native-protocol connections (`clickhouse+native://`, `clickhouse+asynch://`) move
59+
from the native default port 9000 to the HTTP port 8123, because
60+
clickhouse-connect speaks HTTP only — confirm the server's HTTP interface is
61+
reachable. Connections whose settings cannot be carried over exactly (other
62+
URI parameters, a non-default native port, native TLS) stay on the legacy driver
63+
and are logged by database id during the upgrade for manual migration. A
64+
downgrade restores the original URI of every converted connection that has not
65+
been edited since. `DISALLOWED_SQL_FUNCTIONS` gains a `clickhousedb` entry
66+
matching `clickhouse`; deployments that override `DISALLOWED_SQL_FUNCTIONS`
67+
should add it as well.
5368
- Semantic-view filters with an empty IN or NOT IN selection no longer fail with a
5469
query validation error. They follow SQL semantics where the filter sits: an
5570
empty IN matches no rows (grouped charts return no rows; an ungrouped total

‎superset/config.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2694,6 +2694,10 @@ def engine_context_manager( # pylint: disable=unused-argument
26942694
"httpuritype",
26952695
},
26962696
}
2697+
# The lookup is keyed by engine spec ``engine``: ClickHouse connections use
2698+
# ``clickhouse`` (clickhouse-sqlalchemy) or ``clickhousedb`` (clickhouse-connect),
2699+
# and both drivers reach the same server functions.
2700+
DISALLOWED_SQL_FUNCTIONS["clickhousedb"] = set(DISALLOWED_SQL_FUNCTIONS["clickhouse"])
26972701

26982702
# Per-engine blocklist of system catalog tables/views that should not be queried.
26992703
# Prevents information disclosure through system catalog access.

0 commit comments

Comments
 (0)