Skip to content

Conversation

mullimanko
Copy link
Contributor

Closes #24558.

For example, this PR enables the to write to the database multiple times within the same transaction:

import adbc_driver_postgresql.dbapi as pg_dbapi
import polars as pl

conn_str ="postgresql://username:password@host:port/database"

df = pl.DataFrame({"a": [1], "b": [4]})

conn = pg_dbapi.connect(conn_str, autocommit=False)
print(f"Inspect autocommit status: {conn.adbc_connection.get_option("adbc.connection.autocommit")}")

df.write_database("public.table1", connection=conn, engine="adbc")
(df*2).write_database("public.table2", connection=conn, engine="adbc")
conn.commit()

Add autocommit=True to adbc engine
Delete `conn.commit()` becuase `autocommit=True`
@github-actions github-actions bot added A-io-database Area: reading/writing to databases fix Bug fix python Related to Python Polars labels Sep 21, 2025
Copy link

codecov bot commented Sep 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.74%. Comparing base (664656e) to head (252592c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24559      +/-   ##
==========================================
- Coverage   81.76%   81.74%   -0.02%     
==========================================
  Files        1684     1684              
  Lines      229458   229457       -1     
  Branches     2952     2952              
==========================================
- Hits       187616   187579      -37     
- Misses      41099    41135      +36     
  Partials      743      743              

☔ 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.

@alexander-beedie alexander-beedie self-assigned this Sep 22, 2025
@ritchie46 ritchie46 force-pushed the main branch 3 times, most recently from ddf5907 to d0914d4 Compare September 27, 2025 11:06
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 fix Bug fix python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow manual commit of write_database with engine="adbc"
2 participants