Skip to content

feat: implement connection option getters - #65

Merged
abonander merged 2 commits into
ClickHouse:mainfrom
pedro-filardi:feat/connection-option-getters
Nov 13, 2026
Merged

abonander merged 2 commits into
ClickHouse:mainfrom
pedro-filardi:feat/connection-option-getters

Conversation

@pedro-filardi

@pedro-filardi pedro-filardi commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Connection::get_option_string() returned NotImplemented for AutoCommit and CurrentCatalog. ADBC driver managers read these back before they will use a connection, so erroring on them can leave the driver unusable through one.

Rebuilt on top of #72, which already reads CurrentSchema back from the configured database, so the SELECT currentDatabase() from the earlier revision is gone.

  • OptionConnection::AutoCommit → "true". ClickHouse has no transactions, so statements always commit as they run.
  • OptionConnection::CurrentCatalog → "". ClickHouse has no catalog level above the database, which maps onto ADBC's db_schema. That leaves the catalog empty, not unsupported.
  • get_option_bytes() defers to get_option_string(), and get_option_int()/get_option_double() report InvalidArguments, mirroring ClickhouseDatabase.
  • ReadOnly and IsolationLevel keep returning NotImplemented. The error message now matches set_option().

Addresses #8.

Note on scope

This is necessary but not sufficient for a driver manager to attach a ClickHouse database. get_objects() (#10) is required as well.

Checklist

  • 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

🤖 Generated with Claude Code


Note

Low Risk
Targeted read-only option API behavior with tests; no query or auth paths changed.

Overview
Implements Connection::get_option_string() for AutoCommit (always "true" because ClickHouse has no transactions) and CurrentCatalog (always "" because there is no catalog above the database). That unblocks ADBC driver managers that read these options before using a connection.

get_option_bytes() now delegates to get_option_string(); get_option_int() and get_option_double() return InvalidArguments, matching ClickhouseDatabase. Unimplemented options (e.g. ReadOnly, IsolationLevel) use the same error shape as set_option() instead of generic unimplemented stubs.

Adds integration test connection_option_getters and an Unreleased changelog entry.

Reviewed by Cursor Bugbot for commit cdb6a34. Bugbot is set up for automated code reviews on this repo. Configure here.

@CLAassistant

CLAassistant commented Jul 23, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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

Implements missing Connection::get_option_* readbacks needed by ADBC driver managers to successfully validate and use a ClickHouse connection, aligning connection option behavior with the existing ClickhouseDatabase option handling.

Changes:

  • Implemented ClickhouseConnection::get_option_string() for AutoCommit, CurrentCatalog, and CurrentSchema.
  • Made get_option_bytes() delegate to get_option_string(), and updated get_option_int()/get_option_double() to return InvalidArguments.
  • Added integration tests covering the connection option getters and updated the changelog.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/it/main.rs Adds an integration test validating the new connection option getter behaviors and statuses.
src/lib.rs Implements connection option getters (string/bytes/int/double) for well-defined ClickHouse behaviors.
CHANGELOG.md Documents the new option getter support under Unreleased and links the tracking issue.

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

Comment thread src/lib.rs Resolved
Comment thread src/lib.rs Resolved
Report AutoCommit as "true" and CurrentCatalog as empty, since driver
managers read these back before using a connection. get_option_bytes()
defers to get_option_string(), and get_option_int()/get_option_double()
report InvalidArguments, matching ClickhouseDatabase.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pedro-filardi
pedro-filardi force-pushed the feat/connection-option-getters branch from b2c4929 to cdb9105 Compare October 2, 2026 09:26
@security-ai-gate-reviewer

Copy link
Copy Markdown

AI review gate — auto-approval withheld

The AI review gate is green, but the approver did not approve cdb6a342: it comes from a fork, not a branch in this repository: changes from outside need a maintainer's approval.

What to do: ask someone with write access who is not the PR author to approve this pull request.

@abonander
abonander merged commit 6d04e6d into ClickHouse:main Nov 13, 2026
8 checks 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.

6 participants