support in_() with orm.evaluator
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)
-
Account Deleted -
repo owner - changed component to orm
- changed title to support in_() with orm.evaluator
- changed milestone to 0.5.xx
- assigned issue to
- marked as enhancement
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.
-
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.
-
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.
-
repo owner - changed milestone to 0.6.0
-
repo owner - changed milestone to 0.6.xx
-
Account Deleted (original author: ants) Why is this issue assigned to me?
-
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).
-
repo owner - edited description
- removed responsible
-
repo owner - changed milestone to 1.x.xx
- Log in to comment
Er, by .select() I mean .all().