Expr statements do not use argument variables to load objects
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Storm |
New
|
Undecided
|
Unassigned |
Bug Description
First, consider this SQL column definition:
date_created TIMESTAMP WITHOUT TIME ZONE
Second, consider this UTCDateTime property defined to set the timezone:
class UTCDateTimeVari
def __init__(self, *args, **kwargs):
class UTCDateTime(
variable_
Third, consider this class definition referring to the above column definition and property:
class Foo:
date_created = UTCDateTime()
This works fine when getting an object directly from the store:
foo = store.get(Foo, 1)
print foo.date_
<UTC>
However, this doesn't work when using an expression referring to the column:
max_date_created = store.find(
print max_date_
None
The problem seems to be that Expr statements like Max don't look into their expression arguments to determine how the object should be loaded. Instead, in the case of the postgres backend, they rely solely on the loading performed by psycopg2. Since most use cases for statements like Max pass properties as arguments, it would probably be desirable to check the arguments for the most appropriate way to load the objects.
description: | updated |
description: | updated |
description: | updated |
description: | updated |