-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Improve read_database_uri
typing
#19334
feat: Improve read_database_uri
typing
#19334
Conversation
read_database_uri
overloadsread_database_uri
typing
read_database_uri
typingread_database_uri
typing
|
||
|
||
@overload | ||
def read_database_uri( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When it's ambiguous which is being used, we only accept arguments that wouldn't error for either.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #19334 +/- ##
==========================================
+ Coverage 80.21% 80.23% +0.01%
==========================================
Files 1523 1523
Lines 209544 209544
Branches 2434 2434
==========================================
+ Hits 168096 168123 +27
+ Misses 40893 40866 -27
Partials 555 555 ☔ View full report in Codecov by Sentry. |
Very nice - definitely a good addition. |
Thanks! |
This PR improves the typing of
read_database_uri
by adding overloads so that the core set of exceptions it raises are caught by type-checkers, that being:Trying to pass in
excecute_options
with the connector isconnector-x
:And, passing in a list of strings when
adbc
is the driver:I personally encountered the first, and would have valued from having this represented through the overloads.