Skip to content

Registry driver hooks - #584

Open
thomasp85 wants to merge 3 commits into
mainfrom
registry-driver-hooks
Open

thomasp85 wants to merge 3 commits into
mainfrom
registry-driver-hooks

Conversation

@thomasp85

Copy link
Copy Markdown
Collaborator

Fix #575

This is a follow-up to #569 addressing some concerns that came up but were pushed due to the already humonguous size of the PR

In short, it moves more logic into the registry, avoiding to keep weird driver quirks scattered throughout the codebase

AdbcReader now keeps the resolved &'static DatabaseEntry instead of just
the peeled-off AdbcInfo, so quirk access goes through the entry and the
double registry lookup in from_connection_string collapses to one.

OdbcReader resolves the registry entry once per connection and derives
both the dialect and fetch behavior (batch size, numeric-as-double) from
it, replacing the separate detect_or_err / detect calls. Adds
registry::detect_entry_or_err for callers that need the full entry.

First step of #575.
Adds DatabaseEntry::odbc_credential_provider, a pre-connect hook that
rewrites the ODBC connection string. The Snowflake entry points it at a
single apply_workbench_credentials() in odbc/snowflake.rs, and the two
is_snowflake() string-match call sites in from_odbc_conn_str collapse
into one registry-dispatched invocation keyed on the Driver= value.
is_snowflake() itself is removed — its matching is subsumed by registry
detection.

Closes the remaining item of #575.
registry.rs is compiled unconditionally, but odbc::snowflake only exists
with the odbc cargo feature, so the unconditional reference broke
no-default-features builds (CI). Reference the hook through a cfg-gated
constant instead; without the feature the entry simply has no provider.
@thomasp85
thomasp85 requested a review from teunbrand October 9, 2026 11:25

This branch has not been deployed

No deployments
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.

Move driver-specific workarounds behind registry hooks

1 participant