Adam Dziendziel wrote:
> On 27 Gru, 19:58, Michael Bayer <mike...@zzzcomputing.com> wrote:
>> On Dec 27, 2009, at 12:01 PM, Adam Dziendziel wrote:
>>
>> this answer to this required enough creativity and testing that I made
>> it into a usage recipe.   Please give it a road test
>> athttp://www.sqlalchemy.org/trac/wiki/UsageRecipes/GlobalFilterand let
>> me know if its effective.
>
> It is almost ideal. Everything seems to work except the case when I
> use query.get().
>
> This works:
> session.query(m.Course).options(timepoint(datetime(2000,10,11)),
> eagerload('v')).filter_by(id=1).one()
>
> But that doesn't:
> session.query(m.Course).options(timepoint(datetime(2000,10,11)),
> eagerload('v')).get(1)
>
> 'timepoint' is my TemporalOption and 'v' holds a version with
> effectivity timestamps.
>
> When I turn on SQL logging I see 'None' in place of expected parameter
> value.

query.get() doesn't work with filtering criterion.  This because it looks
up in the current session by primary key, and if present issues no SQL. 
If it were filtered, you'd get different results based on whether or not
the object were already loaded or not.    It actually should be raising an
error as get() should be asserting that no existing filter criterion is
set up.


--

You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.


Reply via email to