support in_() with orm.evaluator

Issue #1653 new
Former user created an issue

Working with up-to-date trunk, I can create queries with in_() criteria that work when .select() called on them but fail when .delete() is called. The error is:

sqlalchemy.exc.InvalidRequestError: Could not evaluate current criteria in Python. Specify 'fetch' or False for the synchronize_session parameter.

See attached script.

Comments (10)

  1. Mike Bayer repo owner

    feature enhancement, not a bug. in_() as an in-python evaluator is not supported in 0.5 either. in_() and ~in_() can likely be added though looking at the source code I can see that it might not be very efficient...would have to see what ants has to say.

  2. Former user Account Deleted

    The broken statement was in our codebase and did not raise an exception with SQLAlchemy 0.5. Only when I updated to 0.6 did it begin to fail. Arguably the statement didn't work properly in 0.5 but if it failed it did so silently. Something's definitely changed.

    I will work around the lack-of-feature. Thanks.

  3. Mike Bayer repo owner

    Replying to guest:

    The broken statement was in our codebase and did not raise an exception with SQLAlchemy 0.5. Only when I updated to 0.6 did it begin to fail.

    This is because the options for query.update() and query.delete() default to "evaulate" in 0.6, whereas the default in 0.5 is "expire" which is the same as "fetch". This is described in Changes to query.update() and query.delete() as well as CHANGES.

    You need to migrate your code to 0.6 in this case by specifying the "fetch" option explicitly, to get the same behavior as in 0.5.

  4. Mike Bayer repo owner

    OK that was totally on the wrong tracker. now to remove you from all of these (but I cant remove comments tagged with you, sorry).

  5. Log in to comment