Skip to content

feat: support clickhouse:// URLs#62

Open
abonander wants to merge 4 commits into
mainfrom
ab/url
Open

feat: support clickhouse:// URLs#62
abonander wants to merge 4 commits into
mainfrom
ab/url

Conversation

@abonander

@abonander abonander commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Added support for URLs with the clickhouse:// scheme for automatic detection in ADBC driver managers.
    • Rewrites to https:// scheme by default; add ?protocol=http to the URL to override.
  • Added eager parsing of URLs for immediate feedback instead of erroring on execute.
  • Replaced stubbed-out Database::get_option_string() implementation.

closes #6
closes #43
closes #44

Checklist

Delete items not relevant to your PR:

  • Unit and integration tests covering the common scenarios were added
  • A human-readable description of the changes was provided so that we can include it in CHANGELOG later

@abonander abonander requested a review from koletzilla as a code owner June 23, 2026 21:25
@abonander abonander requested review from Copilot and removed request for koletzilla June 23, 2026 23:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the ADBC ClickHouse driver to accept clickhouse:// connection URLs (to support automatic driver discovery in ADBC driver managers) and to eagerly parse/validate the connection URL when it is set, so malformed inputs fail fast.

Changes:

  • Added parsing/normalization of database Uri via url::Url, including rewriting clickhouse:// to https:// by default with ?protocol=http|https override.
  • Implemented ClickhouseDatabase::get_option_* for string/bytes options (URI/username/password/custom), replacing prior NotImplemented behavior.
  • Added the url crate dependency and unit tests for URL rewriting behavior.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 6 comments.

File Description
src/lib.rs Adds URL parsing/rewriting logic, stores parsed Url, implements option getters, and adds unit tests for URL rewriting.
Cargo.toml Adds the url dependency needed for parsing/rewriting.
Cargo.lock Locks the added url dependency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib.rs Outdated
Comment thread src/lib.rs Outdated
Comment thread src/lib.rs
Comment thread src/lib.rs
Comment thread src/lib.rs
Comment thread src/lib.rs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

Comment thread src/lib.rs
Comment on lines +362 to +366
match key {
OptionDatabase::Uri => Ok(self
.url
.as_ref()
.map_or_else(String::new, |url| url.to_string())),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it doesn't hurt but most drivers don't actually support readback here anyways

Comment thread src/lib.rs
Comment on lines +367 to +369
OptionDatabase::Username => Ok(self.username.clone().unwrap_or_default()),
OptionDatabase::Password => Ok(self.password.clone().unwrap_or_default()),
OptionDatabase::Other(s) => self.get_custom_option(&s),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here: most drivers don't let you read these back anyways, and I suppose for password (and now thinking about it, URI) there's a risk

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.

Eagerly parse connection URI for immediate feedback Support clickhouse:// URI scheme Implement Database::get_option*()

3 participants