It would be helpful if this change was included in the changelog. We were 
upgrading from an old version of SQLAlchemy that used this to do things 
like:

.filter(MyClass.attribute > value if value else None)

And we had some queries mysteriously break from the upgrade :(


On Tuesday, December 18, 2012 at 4:04:47 PM UTC-8, Michael Bayer wrote:
>
>
> On Dec 18, 2012, at 3:53 AM, Yap Sok Ann wrote:
>
> There are a few places in my code that does `q.filter(None)`, e.g. 
> something like this:
>
>     def base_filter(self):
>         # subclasses may set this, or not
>         pass
>
>     def base_query(self):
>         q = self.model_cls.query
>         q = q.filter(self.base_filter())
>         return q
>
> Previously, it would generate "SELECT * FROM xxx".
>
> In 0.8, it now generates "SELECT * FROM xxx WHERE NULL", and subsequently 
> no row is returned.
>
> The change was introduced 2 months ago in 
> http://sqlalchemy.org/trac/changeset/b221bb4385a4
>
> Anyway, the 0.8 behavior does feel a bit more correct, so perhaps I shall 
> fix my code instead :)
>
>
>
> yeah there's no specific use case I had anticipated for filter(None) but 
> rendering NULL is more consistent.
>
>
>

-- 
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.

Reply via email to