-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
Description
What happens?
I'm using the Python API. With certain datetime values, the operation CAST('<timestamp1>' AS TIMESTAMP) - CAST('<timestamp2>' AS TIMESTAMP)
throws an error: OverflowError: Python int too large to convert to C int
.
To Reproduce
To reproduce the issue:
import duckdb
conn = duckdb.connect(':memory:')
conn.execute("SELECT CAST('2023-07-22T11:28:07' AS TIMESTAMP) - CAST('2023-07-23T11:28:07' AS TIMESTAMP)")
conn.fetchall()
However, it doesn't happen with all datetime values: replace the query with e.g. "SELECT CAST('2023-07-22T11:28:07' AS TIMESTAMP) - CAST('2023-07-22T16:46:21' AS TIMESTAMP)"
and the error is gone.
Interestingly, if you simply open the Python command line and enter the following commands, it runs just fine with the same values as above:
import duckdb
duckdb.sql("SELECT CAST('2023-07-22T11:28:07' AS TIMESTAMP) - CAST('2023-07-23T11:28:07' AS TIMESTAMP)")
OS:
Ubuntu 23.10
DuckDB Version:
0.9.2
DuckDB Client:
Python
Full Name:
Jan Novák
Affiliation:
Moseltal Consulting
Have you tried this on the latest main
branch?
I have tested with a main build
Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?
- Yes, I have