You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When querying data values which mismatch the column type in DuckDB using Python a generic duckdb.Exception is encountered instead of duckdb.TypeMismatchException. I'm opening this issue as it seemed there is an opportunity to better align existing exceptions so they may be handled appropriately within Python.
To Reproduce
importsqlite3importduckdb# create a temporary sqlite file locationfilepath=".example.sqlite"# statements for creating database with simple structurecreate_stmts=""" DROP TABLE IF EXISTS tbl_a; CREATE TABLE tbl_a ( col_integer INTEGER NOT NULL ,col_text TEXT ,col_blob BLOB ,col_real REAL ); """# some example values to insert into the databaseinsert_vals= ["nan", "sample", b"sample_blob", 0.5]
# create the database and insert some data into itwithsqlite3.connect(filepath) asconnection:
connection.executescript(create_stmts)
connection.execute(
(
"INSERT INTO tbl_a (col_integer, col_text, col_blob, col_real)""VALUES (?, ?, ?, ?);"
),
insert_vals,
)
try:
duckdb.connect().execute(
f""" /* install and load sqlite plugin for duckdb */ INSTALL sqlite_scanner; LOAD sqlite_scanner; /* perform query on tbl_a table */ SELECT * FROM sqlite_scan('{filepath}', 'tbl_a'); """
).arrow()
exceptduckdb.TypeMismatchExceptionastype_mismatch_e:
print("Found a type mismatch exception: ", type_mismatch_e)
exceptExceptionase:
print("Found a different error of type: ", type(e), e, sep="\n")
OS:
MacOS
SQLite Version:
3.37.0
DuckDB Version:
0.7.1, 0.8.0
DuckDB Client:
Python
Full Name:
Dave Bunten
Affiliation:
University of Colorado
Have you tried this on the latest master branch?
I agree
Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
I agree
The text was updated successfully, but these errors were encountered:
What happens?
When querying data values which mismatch the column type in DuckDB using Python a generic duckdb.Exception is encountered instead of duckdb.TypeMismatchException. I'm opening this issue as it seemed there is an opportunity to better align existing exceptions so they may be handled appropriately within Python.
To Reproduce
OS:
MacOS
SQLite Version:
3.37.0
DuckDB Version:
0.7.1, 0.8.0
DuckDB Client:
Python
Full Name:
Dave Bunten
Affiliation:
University of Colorado
Have you tried this on the latest
master
branch?Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
The text was updated successfully, but these errors were encountered: