Jonathan, Thank you. .op() seems to have done the trick. I'm going to go with it as of now.
Thanx, Rajesh On Monday, February 5, 2018 at 2:55:50 AM UTC+5:30, Jonathan Vanasco wrote: > > > > On Sunday, February 4, 2018 at 11:07:49 AM UTC-5, Mike Bayer wrote: >> >> You test for NULL with == None. I have no idea what your issue is can >> you please share complete mappings, complete stack trace and a reproducible >> example? Thanks >> > > This definitely needs a reproduction testcase to find the correct error as > Mike noted, but if you're stuck in a bind for a temporary fix you can try: > > User.flag.op('IS')(None) > > > using `.op()` has gotten me out of a lot of problems. > > you should also check the sql emitted, because you may need to > '.self_group()' the or_ elements. > > or_(User.flag == None, User.flag != "dnd").self_group() > > > i haven't been able to create a reliable test case for the above, but > there are a handful of times in postgres queries where my or's haven't been > grouped as expected, leading to a bad query. i check everything now. > >> -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- 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 https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.