SQLAlchemy and empty IN clause

前端 未结 5 677
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-02 10:17

I found out that SQLAlchemy translates

db.query(...).filter(A.id.in_(ids))

into

SELECT ...
FROM a
WHERE a.id != a.id

5条回答
  •  天命终不由人
    2021-02-02 10:36

    When I ran into this, it was because I was using an Enum type for one of my database table columns. When I changed it to a String, the problem went away. That's not a real solution, since I would have preferred an Enum, but it did avoid the problem.

提交回复
热议问题