当我尝试在Denodo中查询具有时间戳类型的数据字段时收到错误。我正在使用python 3.7.3和jaydebeapi。
参考下面收到的错误,“%Y-%m-%d%H:%M:%S”确实是字段的格式,而“ 62690377-06-10 23:2”却没有完全出现在原始数据中。
query_complete = (" Select \"DATE\" FROM \"ABC\".\"simple_table\" ")
cursor.execute(query_complete)
rows = cursor.fetchall()
complete_df = pd.DataFrame(rows, columns = list(zip(*cursor.description))[0]
ValueError Traceback (most recent call last)
<ipython-input-7-120011c28139> in <module>
21
22 cursor.execute(query_complete)
---> 23 rows = cursor.fetchall()
24 complete_df = pd.DataFrame(rows, columns = list(zip(*cursor.description))[0])
25
~\AppData\Local\Continuum\anaconda3\lib\site-packages\jaydebeapi\__init__.py in fetchall(self)
558 rows = []
559 while True:
--> 560 row = self.fetchone()
561 if row is None:
562 break
~\AppData\Local\Continuum\anaconda3\lib\site-packages\jaydebeapi\__init__.py in fetchone(self)
530 sqltype = self._meta.getColumnType(col)
531 converter = self._converters.get(sqltype, _unknownSqlTypeConverter)
--> 532 v = converter(self._rs, col)
533 row.append(v)
534 return tuple(row)
~\AppData\Local\Continuum\anaconda3\lib\site-packages\jaydebeapi\__init__.py in _to_datetime(rs, col)
582 if not java_val:
583 return
--> 584 d = datetime.datetime.strptime(str(java_val)[:19], "%Y-%m-%d %H:%M:%S")
585 d = d.replace(microsecond=int(str(java_val.getNanos())[:6]))
586 return str(d)
~\AppData\Local\Continuum\anaconda3\lib\_strptime.py in _strptime_datetime(cls, data_string, format)
575 """Return a class cls instance based on the input string and the
576 format string."""
--> 577 tt, fraction, gmtoff_fraction = _strptime(data_string, format)
578 tzname, gmtoff = tt[-2:]
579 args = tt[:6] + (fraction,)
~\AppData\Local\Continuum\anaconda3\lib\_strptime.py in _strptime(data_string, format)
357 if not found:
358 raise ValueError("time data %r does not match format %r" %
--> 359 (data_string, format))
360 if len(data_string) != found.end():
361 raise ValueError("unconverted data remains: %s" %
ValueError: time data '62690377-06-10 23:2' does not match format '%Y-%m-%d %H:%M:%S'`