Skip to content

Add URL-based configuration support for the ClickHouse adapter#1

Open
quentindemetz wants to merge 2 commits into
masterfrom
qdm/url_adapter
Open

Add URL-based configuration support for the ClickHouse adapter#1
quentindemetz wants to merge 2 commits into
masterfrom
qdm/url_adapter

Conversation

@quentindemetz
Copy link
Copy Markdown

@quentindemetz quentindemetz commented May 4, 2026

Summary

Implements PNixx#200

  • Allows configuring the adapter with a single url key (e.g. clickhouse://user:pass@host:8123/db) instead of specifying every connection field individually
  • Supports optional settings as query parameters: ssl, debug, http_auth, read_timeout, write_timeout, keep_alive_timeout, cluster_name, sslca
  • Explicit config keys take precedence over URL-parsed values, so partial overrides work cleanly
  • Fully backward compatible — existing hash-based config is unchanged

Test plan

  • bundle exec rspec spec/single/url_config_spec.rb — 21 new tests covering basic URL, URL-encoded credentials, all query params, override behaviour, error cases, and backward compatibility
  • bundle exec rspec spec/single/http_auth_spec.rb — existing auth tests still pass
  • bundle exec rspec spec/single/ — full single-node suite passes

quentindemetz and others added 2 commits May 4, 2026 11:11
Allows configuring the adapter via a single `url` key
(e.g. `clickhouse://user:pass@host:8123/db?ssl=true`) instead of
requiring every field to be specified individually. Explicit config keys
take precedence over URL-parsed values.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rails 7.2+ uses the `register` API which calls `ClickhouseAdapter.new`
directly, bypassing `clickhouse_connection` where URL parsing lived.
Move `parse_clickhouse_url` to a public class method on `ClickhouseAdapter`
and call it from `initialize` so it works regardless of entry point.
@quentindemetz quentindemetz marked this pull request as ready for review May 4, 2026 13:53
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.

1 participant