You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a lot of code where I'm trying to find values which are compared like tuples; for example, with an object Foo with fields a, b, and c, doing a comparison like
I can (clumsily, and error-proneily) do something like:
from pony import orm
r = model.Foo.get(id=5)
query = orm.select(q for q in model.Foo if
q.field_a < r.field_a
or (q.field_a == r.field_a and q.field_b < r.field_b)
or (q.field_a == r.field_a and q.field_b == r.field_b and q.field_c < r.field_c))
but it would be nice to be able to instead just do:
query = orm.select(q for q in model.Foo if (q.field_a,q.field_b,q.field_c) < (r.field_a,r.field_b,r.field_c))
Pony successfully generates a query for that statement, but the resuling SQL is incorrect, in that it only compares field_c. For example (with a real, non-metasyntactic example):
# Features
* #472: Python 3.8 support
* Support of hybrid functions (inlining simple Python functions into query)
* #438: support datetime-datetime, datetime-timedelta, datetime+timedelta in queries
# Bugfixes
* #430: add ON DELETE CASCADE for many-to-many relationships
* #465: Should reconnect to MySQL on OperationalError 2013 'Lost connection to MySQL server during query'
* #468: Tuple-value comparisons generate incorrect queries
* #470 fix PendingDeprecationWarning of imp module
* Fix incorrect unpickling of objects with Json attributes
* Check value of discriminator column on object creation if set explicitly
* Correctly handle Flask current_user proxy when adding new items to collections
* Some bugs in syntax of aggregated queries were fixed
* Fix syntax of bulk delete queries
* Bulk delete queries should clear query results cache so next select will get correct result from the database
* Fix error message when hybrid method is too complex to decompile
Uh oh!
There was an error while loading. Please reload this page.
I have a lot of code where I'm trying to find values which are compared like tuples; for example, with an object
Foo
with fieldsa
,b
, andc
, doing a comparison likeI can (clumsily, and error-proneily) do something like:
but it would be nice to be able to instead just do:
Pony successfully generates a query for that statement, but the resuling SQL is incorrect, in that it only compares
field_c
. For example (with a real, non-metasyntactic example):Using a
lambda
fares no better:So, either the API allows a thing it shouldn't, or the implementation of that support is incorrect. Either way it'd be nice for it to work right.
The text was updated successfully, but these errors were encountered: