mavestergaard opened a new issue, #538:
URL: https://github.com/apache/arrow-adbc/issues/538
I am using polars library to write to Azure Postgre SQL DB.
<details>
<summary>This is my code:</summary>
```
import polars as pl
from datetime import datetime
data = {
'text': ['foo', 'bar', 'baz'],
'bool': [True, False, True],
'datetime': [datetime.now(), datetime.now(), datetime.now()],
'date': ['2022-03-24', '2022-03-23', '2022-03-22'],
'float': [1.1, 2.2, 3.3]
}
df = pl.DataFrame(data, schema={
'text': pl.Utf8,
'bool': pl.Boolean,
'datetime': pl.Datetime('us', None),
'date': pl.Date,
'float': pl.Float64
})
connection_string =
f"postgresql://{servername}:5432/{dbname}?user={username}&password={pw}"
df.write_database(
table_name="schema_name.my_table",
connection_uri=connection_string,
if_exists='append',
engine='adbc'
)
```
</details>
<details>
<summary>This is the error:</summary>
```
df.write_database(
File
"/home/mv/.virtualenvs/env_fsspec/lib/python3.10/site-packages/polars/dataframe/frame.py",
line 2940, in write_database
with _open_adbc_connection(connection_uri) as conn:
File
"/home/mv/.virtualenvs/env_fsspec/lib/python3.10/site-packages/adbc_driver_manager/dbapi.py",
line 217, in __exit__
self.close()
File
"/home/mv/.virtualenvs/env_fsspec/lib/python3.10/site-packages/adbc_driver_manager/dbapi.py",
line 302, in close
self._conn.close()
File "adbc_driver_manager/_lib.pyx", line 851, in
adbc_driver_manager._lib.AdbcConnection.close
File "adbc_driver_manager/_lib.pyx", line 452, in
adbc_driver_manager._lib._AdbcHandle._check_open_children
File "adbc_driver_manager/_lib.pyx", line 454, in
adbc_driver_manager._lib._AdbcHandle._check_open_children
RuntimeError: Cannot close AdbcConnection with open AdbcStatement
```
</details>
<details>
<summary>Versions I have installed:</summary>
```
adbc-driver-manager==0.3.0
adbc-driver-postgresql==0.3.0
pandas==1.5.3
polars==0.16.14
pyarrow==11.0.0
```
</details>
Please let me know if you need anything further.
Many thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]