Ошибка запроса данных временной метки с использованием Python и Jaydebeapi - PullRequest
0 голосов
/ 09 июля 2019

Я получаю сообщение об ошибке при попытке запросить поля данных в Denodo, которые имеют тип отметки времени.Я использую Python 3.7.3 и jaydebeapi.

Ссылка на ошибку, которую я получаю ниже, «% Y-% m-% d% H:% M:% S» действительно, как форматируется полеи «62690377-06-10 23: 2» вообще не отображается в исходных данных.

  • Если я преобразую поле в строку, запрос будет работать нормально.
  • Другие пользователи в моей группе могут без проблем запрашивать данные отметки времени, используя ту же версию Python и jaydebeapi, а также фрагмент кода ниже.
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'`

...