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

DataFrame.write_database() not passing along engine_options when using ADBC #18478

Closed
2 tasks done
skellys opened this issue Aug 30, 2024 · 1 comment · Fixed by #18451
Closed
2 tasks done

DataFrame.write_database() not passing along engine_options when using ADBC #18478

skellys opened this issue Aug 30, 2024 · 1 comment · Fixed by #18451
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@skellys
Copy link
Contributor

skellys commented Aug 30, 2024

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

Repro on polars 1.6.0:

import polars as pl
import adbc_driver_sqlite.dbapi as sqlite_dbapi

conn = sqlite_dbapi.connect(":memory:")
df = pl.DataFrame({"colx": [1, 2, 3]})
temp_tbl_name = "should_be_temptable"

rows_affected = df.write_database(
    temp_tbl_name,
    connection=conn,
    if_table_exists="fail",
    engine_options={"temporary": True},
)
assert rows_affected == 3

temp_tbl_sql_df = pl.read_database(
    "select sql from sqlite_temp_master where type='table' and tbl_name = ?",
    connection=conn,
    execute_options={"parameters": [temp_tbl_name]},
)
assert temp_tbl_sql_df.shape[0] == 1, "no temp table created"

Log output

No response

Issue description

Execution options are not being passed along to the driver when calling DataFrame.write_database() and using an ADBC driver.

Expected behavior

Expected engine_options to be passed along, resulting in proper creation of temporary tables when using ADBC drivers.

Installed versions

--------Version info---------
Polars:              1.6.0
Index type:          UInt32
Platform:            macOS-14.6.1-arm64-arm-64bit
Python:              3.12.5 (main, Aug  6 2024, 19:08:49) [Clang 15.0.0 (clang-1500.3.9.4)]

----Optional dependencies----
adbc_driver_manager  1.1.0
altair               <not installed>
cloudpickle          <not installed>
connectorx           <not installed>
deltalake            <not installed>
fastexcel            <not installed>
fsspec               <not installed>
gevent               <not installed>
great_tables         <not installed>
matplotlib           <not installed>
nest_asyncio         <not installed>
numpy                2.1.0
openpyxl             <not installed>
pandas               <not installed>
pyarrow              17.0.0
pydantic             <not installed>
pyiceberg            <not installed>
sqlalchemy           <not installed>
torch                <not installed>
xlsx2csv             <not installed>
xlsxwriter           <not installed>

@skellys skellys added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Aug 30, 2024
@skellys
Copy link
Contributor Author

skellys commented Aug 30, 2024

I have a proposed fix with test coverage on this PR: #18451

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
None yet
1 participant