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

test(python): Fix test failing due to new adbc release #10763

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions py-polars/tests/unit/io/test_database_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,31 @@ def test_write_database(

# note: test a table name that requires quotes to ensure that we handle
# it correctly (also supply an explicit db schema with/without quotes)
tbl_name = '"test-data"'
table_name = "test_data"

sample_df.write_database(
table_name=f"main.{tbl_name}",
table_name=table_name,
connection=f"sqlite:///{test_db}",
if_exists="replace",
engine=engine,
)
if mode == "append":
sample_df.write_database(
table_name=f'"main".{tbl_name}',
table_name=table_name,
connection=f"sqlite:///{test_db}",
if_exists="append",
engine=engine,
)
sample_df = pl.concat([sample_df, sample_df])

result = pl.read_database_uri(f"SELECT * FROM {tbl_name}", f"sqlite:///{test_db}")
result = pl.read_database_uri(f"SELECT * FROM {table_name}", f"sqlite:///{test_db}")
sample_df = sample_df.with_columns(pl.col("date").cast(pl.Utf8))
assert_frame_equal(sample_df, result)

# check that some invalid parameters raise errors
for invalid_params in (
{"table_name": "w.x.y.z"},
{"if_exists": "crunk", "table_name": f"main.{tbl_name}"},
{"if_exists": "crunk", "table_name": table_name},
):
with pytest.raises((ValueError, NotImplementedError)):
sample_df.write_database(
Expand Down