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
use TRY_CAST, expecting it to insert as null | bigint
get an error
To Reproduce
importosimportsqlite3importduckdbforfilein ('file.sqlite', 'file.duckdb'):
ifos.path.exists(file):
os.remove(file)
withsqlite3.connect('file.sqlite') asconn:
conn.execute(
""" CREATE TABLE mytable ( id integer primary key autoincrement , gain int ) """)
forvalueinrange(1, 5):
conn.execute("INSERT INTO mytable (gain) values (?)", [value])
conn.execute("INSERT INTO mytable (gain) values ('')")
withduckdb.connect('file.duckdb') asconn:
conn.execute("INSTALL sqlite; LOAD sqlite;")
conn.execute("ATTACH 'file.sqlite' as _sqlite (TYPE sqlite);")
conn.execute("CREATE TABLE mytable as select * from _sqlite.mytable LIMIT 0") # import schema onlyconn.execute("INSERT INTO mytable select id, TRY_CAST(gain as BIGINT) from _sqlite.mytable")
leads to
Traceback (most recent call last):
File "test.py", line 21, in <module>
with duckdb.connect('file.duckdb') as conn:
File "test.py", line 25, in <module>
conn.execute("INSERT INTO mytable select id, TRY_CAST(gain as BIGINT) from _sqlite.mytable")
duckdb.duckdb.TypeMismatchException: Mismatch Type Error: Invalid type in column "gain": column was declared as integer, found "" of type "text" instead.
OS:
win10 x64
SQLite Version:
3.43.1
DuckDB Version:
1.0.0
DuckDB Client:
python
Full Name:
Aaron C
Affiliation:
n/a
Have you tried this on the latest main 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?
TRY_CAST
, expecting it to insert asnull | bigint
To Reproduce
leads to
OS:
win10 x64
SQLite Version:
3.43.1
DuckDB Version:
1.0.0
DuckDB Client:
python
Full Name:
Aaron C
Affiliation:
n/a
Have you tried this on the latest
main
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: