On Mon, Mar 30, 2015 at 10:59 AM, Jose Soares <jose.soa...@sferacarta.com> wrote: > Hi all, > > While I changed some obsolete syntax as defined in > (https://www.python.org/dev/peps/pep-0008/) > like (is True instead of ==True) also False and None. > I realized that sqlalchemy do not support them > What can I do to avoid this behavior? > > > ------------------------------------------------------ > > print > session.query(Rischio.c.codice).select_from(Rischio).filter(Rischio.c.peso_gruppo > == True) > > SELECT caratteristica_rischio.codice AS caratteristica_rischio_codice > FROM caratteristica_rischio > WHERE caratteristica_rischio.peso_gruppo = true > > print > session.query(Rischio.c.codice).select_from(Rischio).filter(Rischio.c.peso_gruppo > is True) > SELECT caratteristica_rischio.codice AS caratteristica_rischio_codice > FROM caratteristica_rischio > WHERE false >
I don't think you can. SQLAlchemy expressions define an "__eq__" method to enable "expression == value"-style constructs. There is no equivalent hook in Python for the "is" operator, so there is no way SQLAlchemy could use it. Simon -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.