【发布时间】:2022-01-23 05:14:24
【问题描述】:
我在 Python 3.9 上运行 psycopg2,查询 Redshift 表。
我正在查询一个带有 SELECT * 传递给 cursor.execute() 方法的表:
query = 'select * from my_schema.my_table;'
cursor = connection.cursor(cursor_factory=RealDictCursor) # psycopg2 connection
cursor.execute(query)
data = cursor.fetchall()
而且,我得到了以下信息:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "mypython.py", <lines>
File "/usr/local/lib/python3.9/site-packages/psycopg2/extras.py", line 236, in execute
return super().execute(query, vars)
psycopg2.errors.InternalError_: Assert
DETAIL:
-----------------------------------------------
error: Assert
code: 1000
context: status == 0 - timestamp: '-9223372036854775808'
query: <query #>
location: cg_util.cpp:705
process: <process>
-----------------------------------------------
我可以查询不同架构和相同架构的其他表,但不能查询这个表。
该表具有varchar 和timestamp 列类型。我在其中一列中使用了-infinity Special Date/Time Input。
【问题讨论】:
-
如果删除“cursor_factory=RealDictCursor”会发生什么?
标签: python postgresql psycopg2