On 04/27/2016 01:09 PM, [email protected] wrote:
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 :(


"make me an ice cream sandwich" - poof! you're an ice cream sandwich. Last part of http://docs.sqlalchemy.org/en/latest/changelog/migration_09.html#improved-rendering-of-boolean-constants-null-constants-conjunctions talks about this. Unfortunately with each major release, there's lots of little miscellaneous changes like this so not much option other than scanning through each "migration" document. But I'm extremely careful to include every possible change in behavior in these documents.




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
    <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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to