Validate and route unknown connect() keywords - #41
Merged
Conversation
LuckySting
approved these changes
Aug 27, 2026
Leftover keywords were stored in connection_kwargs and never read, so a mis-routed option like disable_discovery passed through a SQLAlchemy URL was indistinguishable from one that did not help. Route them into ydb.DriverConfig kwargs by introspecting its signature, coerce string values (URL query params arrive as strings, so "false" was truthy), and raise ProgrammingError on anything the driver cannot accept. Fixes #40
vgvoleg
force-pushed
the
fix-silent-connect-kwargs
branch
from
August 27, 2026 11:31
5c38743 to
2bb5b55
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #40.
connect()stored leftover keywords inconnection_kwargsand never read them. Through a SQLAlchemy URL every query parameter lands there, so?disable_discovery=truewas silently dropped with no way to tell it apart from an option that did not help.Changes
prepare_driver_config_kwargs()inutils.py: routes leftover keywords intoydb.DriverConfigkwargs, resolving valid names frominspect.signature(ydb.DriverConfig.__init__)rather than a local list that would go stale as the SDK gains parameters.?disable_discovery=falsewas a truthy string and disabled discovery.ProgrammingErrorfor unknown names, unparseable values, and options passed both directly and viadriver_config_kwargs.ydb_session_poolnow raise: noDriverConfigis built there, so accepting them would keep the same silent behavior.auth_tokentogether withcredentialsnow raises.DriverConfigletsauth_tokenoverwritecredentials; the keyword used to be dropped entirely, so this guard comes with making it live._additional_sdk_headersis untouched apart from being popped earlier, before validation runs — otherwise it would trip the new check on the shared-pool path.Behavior change
Keywords that are silently ignored today start raising, including
user:password@in a URL (not a documented form in ydb-sqlalchemy).driver_config_kwargspassed alongsideydb_session_poolwas ignored and now raises.Verification
poetry run poe tests— 131 passed.poetry run poe lintgreen. Checked against a local YDB with the exact keywords SQLAlchemy produces:disable_discovery="true"→True,"false"→False, typos andusername/password→ProgrammingError.