connector-x
connector-x copied to clipboard
' panicked at 'Could not retrieve core::option::Option<chrono::naive::datetime::NaiveDateTime> from Value'
- the connectorx version is : 0.2.4
Hi @ztsweet , we might need more information:
- What database are you using? (e.g. postgres, mysql)
- What
return_type
do you get? (e.g. pandas, arrow) - Would be better if you could provide a simple example that we could reproduce your error
thanks @wangxiaoying
- the code like:
df = pl.read_sql(sql, conn)
- the database is mysql
- I guess the most likely reason is that the datetime means like '0000/00/00 00:00:00'
Hi @ztsweet , sorry for the late reply. It seems like '0000/00/00 00:00:00' is not a valid datetime for mysql.

https://dev.mysql.com/doc/refman/8.0/en/datetime.html#:~:text=MySQL%20retrieves%20and%20displays%20DATETIME,both%20date%20and%20time%20parts.
I get a similar error for date values that come back from the database as 0000-00-00
.
I had a similar issue, when tried to select datetime columns on MySQL.
Had to change datetime col to string such as,
SELECT DATE_FORMAT(date, '%Y-%m-%d') FROM TABLE
.
same error, and try catch not work.
I had a similar issue, when tried to select something on MySQL. pyo3_runtime.PanicException: Could not retrieve chrono::naive::datetime::NaiveDateTime from Value I use connectorx==0.3.1 ,first demo not work.