How would I write the following SQL query in SQLAlchemy involving a bitwise and?
select * from table where flags &
You want to use the bitwise operator like this:
session.query(User).filter(somecolumn.op('&')(1) == 1)
You can write something similar for OR:
session.query(User).filter(somecolumn.op('|')(4) > 4)