Skip to content

Allow manual commit of write_database with engine="adbc" #24558

@mullimanko

Description

@mullimanko

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

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.table2", connection=conn, engine="adbc")

# The `public.table2` is created, despite that `conn.commit()` wasn't used.

Log output

Issue description

Currently, it's not possibe to use one or multiple write_database(..., engine="adbc") within the same transaction and then do a manual commit, for details, see https://stackoverflow.com/q/79761286/13968392.

Expected behavior

The df.write_database(..., engine="adbc") should comply with the autocommit in pg_dbapi.connect(conn_str, autocommit=False).

Installed versions

--------Version info---------
Polars:              1.33.1
Index type:          UInt32
Platform:            Windows-11-10.0.26100-SP0
Python:              3.13.5 (main, Jul 23 2025, 00:30:06) [MSC v.1944 64 bit (AMD64)]
LTS CPU:             False

----Optional dependencies----
Azure CLI            <not installed>
adbc_driver_manager  1.7.0
altair               5.5.0
azure.identity       <not installed>
boto3                <not installed>
cloudpickle          <not installed>
connectorx           0.4.4
deltalake            <not installed>
fastexcel            0.15.1
fsspec               2025.9.0
gevent               <not installed>
google.auth          2.40.3
great_tables         <not installed>
matplotlib           3.10.6
numpy                2.2.6
openpyxl             3.1.5
pandas               2.3.2
polars_cloud         <not installed>
pyarrow              21.0.0
pydantic             <not installed>
pyiceberg            <not installed>
sqlalchemy           2.0.43
torch                <not installed>
xlsx2csv             0.8.4
xlsxwriter           3.2.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds triageAwaiting prioritization by a maintainerpythonRelated to Python Polars

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions