Sqlalchemy instancemethod对象无法订阅in_方法

Sqlalchemy instancemethod对象无法订阅in_方法,sqlalchemy,python-2.5,Sqlalchemy,Python 2.5,我有以下代码 from sqlalchemy import * from sqlalchemy.orm import * engine = create_engine("postgresql+psycopg2://test:password@localhost/test") Session = sessionmaker(bind=engine) session = Session() metadata = MetaData() metadata.bind = engine table = Ta

我有以下代码

from sqlalchemy import *
from sqlalchemy.orm import *

engine = create_engine("postgresql+psycopg2://test:password@localhost/test")
Session = sessionmaker(bind=engine)
session = Session()
metadata = MetaData()
metadata.bind = engine
table = Table('test_table', metadata, autoload = True)
a = session.query(table).filter(table.c.id.in_['1', '2'])
这就是遇到的错误

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'instancemethod' object is unsubscriptable
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
TypeError:“instancemethod”对象不可订阅
我确信这是我做错的事情,因为我是python新手。提前谢谢(我敢肯定这是新手犯的错误)

是一个函数,因此必须调用它。应采取以下措施:

a = session.query(table).filter(table.c.id.in_(['1', '2']))

我很确定这是新手犯的错误。感谢您的快速回复:)