我試圖做的SQLAlchemy的查詢一個簡單的過濾器操作,像這樣:SQLAlchemy的過濾器IN_操作
q = session.query(Genotypes).filter(Genotypes.rsid.in_(inall))
其中
inall是一個字符串列表 基因型被映射到表: 類基因型(對象): 通
Genotypes.mapper = mapper(Genotypes, kg_table, properties={'rsid': getattr(kg_table.c, 'rs#')})
這看起來非常簡單給我,但我得到的F當我執行上述查詢時出現錯誤q.first()
:
"sqlalchemy.exc.OperationalError: (OperationalError) too many SQL variables u'SELECT" followed by a list of the 1M items in the inall list. But they aren't supposed to be SQL variables, just a list whose membership is the filtering criteria.
我在做錯誤的過濾嗎?
(分貝是sqlite的)