feat: make Backend._from_url() consistently use kwargs as overrides #11185
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.
Before, if you did
ibis.postgres.connect("postgresql://user:password@host/my_db", schema="my_schema")
, then the schema in the url (in this case, it is blank) took precendence, and the backend would get a schema argument of "". Now, we consistently use the url as the defaults, but then always override them with what you pass explicitly as a kwarg.This also just is a refactor and cleans up many implementations.
For example, it now makes it so that if a section of the url is missing, such as the password, then do_connect() is simply called without a "password" param. Before, for some backends, it was called with a default. This made it brittle in case we ever changed the default, or renamed params.
It also removes some unneeded boilderplate for snowflake, that is taken care of inside the do_connect(). in general, I think we should make it so that _from_url() is very minimal and does very little parameter coercion and setting defaults, and make do_connect() be responsible for that. If we do this, then we are more likely to keep consistency between the ibis.connect() and ibis.backend.connect() code paths.