11 ms·
Nitpick, SQLAlchemy overrides the binary operators (~, &, |) for query construction, not the logical operators (and, or, not). It also has its own operators you
by greenshackle3 9y ago
Nitpick, SQLAlchemy overrides the binary operators (~, &, |) for query construction, not the logical operators (and, or, not). It also has its own operators you can import (and_, or_, etc.)
And you are right, it can easily lead to mistakes; if you use logical operators by mistake when building a query, you will probably get 'True' instead of a query object.
- weberc2 9y agoI appreciate your nitpick! It's been a little while since I used SQLAlchemy, and I did run into surprises with these overloaded operators.