1. Michael Bayer
  2. sqlalchemy
  3. Issues

Issues

Issue #1653 new

support in_() with orm.evaluator

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

    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.

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

  3. Log in to comment