connector-x icon indicating copy to clipboard operation
connector-x copied to clipboard

' panicked at 'Could not retrieve core::option::Option<chrono::naive::datetime::NaiveDateTime> from Value'

Open ztsweet opened this issue 2 years ago • 9 comments

  • the connectorx version is : 0.2.4

ztsweet avatar Apr 12 '22 00:04 ztsweet

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

wangxiaoying avatar Apr 12 '22 03:04 wangxiaoying

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'

ztsweet avatar Apr 14 '22 06:04 ztsweet

Hi @ztsweet , sorry for the late reply. It seems like '0000/00/00 00:00:00' is not a valid datetime for mysql.

image

https://dev.mysql.com/doc/refman/8.0/en/datetime.html#:~:text=MySQL%20retrieves%20and%20displays%20DATETIME,both%20date%20and%20time%20parts.

wangxiaoying avatar May 01 '22 01:05 wangxiaoying

I get a similar error for date values that come back from the database as 0000-00-00.

kesmit13 avatar May 03 '22 14:05 kesmit13

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.

NamSahng avatar Dec 26 '22 05:12 NamSahng

same error, and try catch not work.

showkeyjar avatar May 05 '23 12:05 showkeyjar

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.

sunshicheng avatar Jan 09 '24 00:01 sunshicheng