I'd like to achieve toggling a boolean flag with just one query.
My query looks as follows:
session.query(Foo).update({"status": SOME_NOT_OPERATOR})
Does SQLAlchemy supports PostgreSQL NOT (https://www.postgresql.org/docs/current/functions-logical.html) operator. How this can be achieved different way?
... update({"status": SOME_NOT_OPERATOR})is about setting a value not using an operator. Ifstatusis indeed abooleantype and you want to toggle it the:{"status": True}or{"status": False}.statusset to whichever value it isn't already, without having to query the value to decide whether to set it toTrueorFalse.SQLAlchemyset up, so can't test. Maybe try{"status": ~Foo.status}per Invert.