Skip to content

fix(python): Fix DataFrame.write_database(..., if_table_exists="append", engine="adbc") not handling missing tables correctly#26913

Open
ilya-pevzner wants to merge 4 commits intopola-rs:mainfrom
ilya-pevzner:main
Open

fix(python): Fix DataFrame.write_database(..., if_table_exists="append", engine="adbc") not handling missing tables correctly#26913
ilya-pevzner wants to merge 4 commits intopola-rs:mainfrom
ilya-pevzner:main

Conversation

@ilya-pevzner
Copy link

Why these changes?

This PR addresses issue #26906 where df.write_database(..., if_table_exists="append", engine="adbc") failed if the target table did not exist. The expected behavior for "append" is often to create the table if missing.

What was changed?

  • The mode parameter for ADBC write_database is now dynamically set to "create_append" when adbc-driver-manager version is >= 0.7.0.
  • For older adbc-driver-manager versions (< 0.7.0), the mode remains "append" to maintain backward compatibility, as "create_append" was introduced in ADBC 0.7.0.
  • A new unit test, test_write_database_append_creates_missing_table, has been added to verify that if_table_exists="append" correctly creates a missing table for both SQLAlchemy and ADBC engines. The ADBC part of the test is skipped if the adbc-driver-manager version is too old to support "create_append".

  1. I used AI to implement the version-gated logic for ADBC mode and to add the corresponding unit test.
  2. I confirm that I have reviewed all changes myself, and I believe they are relevant and correct.

As requested, since I am a first time contributor, I am including a screenshot of me successfully running the test suite (make test) locally on my machine (not the CI).
image

cursoragent and others added 2 commits March 13, 2026 04:44
Co-authored-by: IAP <ilya-pevzner@users.noreply.github.com>
@github-actions github-actions bot added A-io-database Area: reading/writing to databases fix Bug fix python Related to Python Polars first-contribution First contribution by user labels Mar 14, 2026
@codecov
Copy link

codecov bot commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.74%. Comparing base (3ee3f1b) to head (c79db83).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #26913   +/-   ##
=======================================
  Coverage   81.73%   81.74%           
=======================================
  Files        1806     1806           
  Lines      248701   248701           
  Branches     3133     3133           
=======================================
+ Hits       203287   203290    +3     
+ Misses      44609    44606    -3     
  Partials      805      805           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-io-database Area: reading/writing to databases first-contribution First contribution by user fix Bug fix python Related to Python Polars

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants