Skip to content
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(python): Improve write_database, accounting for latest adbc fixes/updates #12713

Merged

Conversation

alexander-beedie
Copy link
Collaborator

@alexander-beedie alexander-beedie commented Nov 27, 2023

Closes #12684.
Ref: #10763, #11282 (comment).

Enhancements

Updates pl.write_database and associated tests with various improvements now that some key issues (apache/arrow-adbc#1000, apache/arrow-adbc#1109) have been resolved in the ADBC 0.7 and 0.8 releases, respectively.

  • Enables correct resolution of schema-qualified names (eg: schema.table_name).
  • Adds ADBC engine support for if_exists = "fail" (simulated).
  • Adds ADBC engine support for if_exists = "replace" (native).
  • All write tests now able to run under Python 3.12.

Requires that the caller has installed at least ADBC version 0.7 for "replace" support, or 0.8 if using schema-qualified names, as these versions contain the related/required fixes (if not doing either of these things earlier versions of ADBC continue to work fine).

Note

In addition to SQLite (what we run in CI), I was able to validate these updates against a local PostgreSQL instance.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars labels Nov 27, 2023
@alexander-beedie alexander-beedie force-pushed the adbc-write-database-fixes branch 3 times, most recently from f42d027 to 0c67adf Compare November 27, 2023 12:16
@alexander-beedie alexander-beedie force-pushed the adbc-write-database-fixes branch from 0c67adf to a1a93b6 Compare November 27, 2023 12:20
Copy link
Contributor

@stinodego stinodego left a comment

Choose a reason for hiding this comment

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

This looks good 👌

I'm just wondering if we should set a minimum version for the adbc dependencies. Are there any older version that are fundamentally at odds with our current implementation?

@stinodego stinodego changed the title feat(python): improve write_database, accounting for latest adbc fixes/updates feat(python): Improve write_database, accounting for latest adbc fixes/updates Nov 28, 2023
@alexander-beedie
Copy link
Collaborator Author

alexander-beedie commented Nov 28, 2023

I'm just wondering if we should set a minimum version for the adbc dependencies. Are there any older version that are fundamentally at odds with our current implementation?

Checked that these updates work fine with ADBC 0.5 and 0.6, but I think we should raise an error if given schema-qualified table names, as robust handling of these requires a recent ADBC version (not an issue with our implementation, but we can save the user from tripping themselves up by detecting it and directing them to upgrade ✌️)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

write_database replace table not working
2 participants