Skip to content

feat: make Backend._from_url() consistently use kwargs as overrides #11185

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

Merged
merged 1 commit into from
May 8, 2025

Conversation

NickCrews
Copy link
Contributor

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.

@github-actions github-actions bot added impala The Apache Impala backend postgres The PostgreSQL backend clickhouse The ClickHouse backend mysql The MySQL backend pyspark The Apache PySpark backend bigquery The BigQuery backend snowflake The Snowflake backend mssql The Microsoft SQL Server backend trino The Trino backend druid The Apache Druid backend oracle The Oracle backend exasol Issues related to the exasol backend risingwave The RisingWave backend labels May 5, 2025
@NickCrews NickCrews force-pushed the make-from-url-consistent branch from c6d2965 to b145bdf Compare May 7, 2025 16:25
Copy link
Member

@cpcloud cpcloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@cpcloud cpcloud merged commit 14d103a into ibis-project:main May 8, 2025
110 of 111 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bigquery The BigQuery backend clickhouse The ClickHouse backend druid The Apache Druid backend exasol Issues related to the exasol backend impala The Apache Impala backend mssql The Microsoft SQL Server backend mysql The MySQL backend oracle The Oracle backend postgres The PostgreSQL backend pyspark The Apache PySpark backend risingwave The RisingWave backend snowflake The Snowflake backend trino The Trino backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants