我有一个表格,其列表类型为double precision[]
,如下所示:
from sqlalchemy import Column, String, ARRAY
mytablename= 'mytable'
class create_my_array_table(Base):
__tablename__ = mytablename
id = Column(String(3000, convert_unicode= False), primary_key= True)
myarray= Column(ARRAY(Float), unique=False)
所以如果我有一个数组(Python列表) v ,这就是我试图查询它的方式。
v = [0.0112, 0.235, 0.25...]
myDBtable= Table(mytablename, metadata, autoload = True, autoload_with = engine)
myquery =session.query(myDBtable).filter(myDBtable.c.vector ==v)
##test
for line in myquery:
print(line)
我收到了这个错误:
psycopg2.ProgrammingError: operator does not exist: double precision[] = numeric[]
LINE 3: WHERE mytable.myarray= ARRAY[0.0112, 0.235...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.