我有一份身份证清单,比如:
tracker_ids = [69]
我需要根据追踪器的id获取所有的信息对象
数据如下:
^{pr2}$我尝试了下面的方法,但它产生了一个错误。在
session.query(APInformation).\
filter(APInformation.data['tracker_id'].in_(tracker_ids),
APInformation.data['datetime'].astext.cast(BigInteger) > 1539053379040).\
all()
它引发的错误:
ProgrammingError: (psycopg2.ProgrammingError) operator does not exist: jsonb = integer
LINE 3: ...oring_apinfomation".data -> 'tracker_id') IN (69)
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
在将jsonb值与IN谓词一起使用之前,必须对其进行强制转换,就像对datetime值所做的那样:
相关问题 更多 >
编程相关推荐