Skip to content

Validate ClickHouse DSNs on startup - #83

Merged
knadh merged 2 commits into
zerodha:masterfrom
johnnybravo-xyz:clickhouse-dsn-validation
Oct 26, 2026
Merged

knadh merged 2 commits into
zerodha:masterfrom
johnnybravo-xyz:clickhouse-dsn-validation

Conversation

@johnnybravo-xyz

@johnnybravo-xyz johnnybravo-xyz commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

#82.

Checks ClickHouse DSNs before connecting, since clickhouse-go v1 reads credentials and the database only from query params and silently mangles an unencoded password.

  • Errors on a DSN with no host, an invalid URL, or an invalid %-escape or raw ; in the query.
  • Warns on user:pass@, a /db path, or a missing username, so existing DSNs that rely on the default user keep working.
  • Prefixes connection errors with the DB name. No message includes any part of the DSN.
  • Documents the DSN format for each driver in the README and fixes the ClickHouse sample config.

dbpool.New now takes a *slog.Logger for the warnings. Unit tests cover the valid, error and warning cases.

johnnybravo-xyz and others added 2 commits October 26, 2026 09:47
Reject ClickHouse DSNs with no host or an invalid %-escape, and warn
about user:pass@, /dbname and a missing username, which clickhouse-go
v1 silently ignores. Name the failing DB in connection errors and
document the DSN formats.
@knadh
knadh merged commit c5a4089 into zerodha:master Oct 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants