Hello.

I have one more question about my approach to WindowedRangeQuery:

> * Suppose a complex query q with join(...), filter(...) and options(...).
> * I need to create q2 from q such that:
>  * It has no options.
>    * Can I reset the options with q = q.options(None)?
>  * It has select with the over by magic taken from WindowedRangeQuery recipe.
>    * I know I can use with_entities() for this.
> * I will use q2 to obtain the window ranges.
> * I will iterate over the window ranges and apply each to the original q and
> execute it in a loop.

Suppose I have a complex query (without options() / order_by()) to obtain the
objects I want. I use this query to calculate window intervals. I don't have to
use it again to fetch the objects, because I already have their id intervals. Am
I right?


Thank you,

Ladislav Lenart


On 4.6.2013 19:15, Ladislav Lenart wrote:
> On 4.6.2013 18:49, Michael Bayer wrote:
>>
>> On Jun 4, 2013, at 12:28 PM, Ladislav Lenart <lenart...@volny.cz> wrote:
>>
>>>
>>>> Absolutely, you should do whatever you have to in order to get the range
>>>> you want, in fact the recipe even says this...
>>>
>>> Ok. What I want to do is basically the following:
>>> * Suppose a complex query q with join(...), filter(...) and options(...).
>>> * I need to create q2 from q such that:
>>>  * It has no options.
>>>    * Can I reset the options with q = q.options(None)?
>>>  * It has select with the over by magic taken from WindowedRangeQuery 
>>> recipe.
>>>    * I know I can use with_entities() for this.
>>> * I will use q2 to obtain the window ranges.
>>> * I will iterate over the window ranges and apply each to the original q and
>>> execute it in a loop.
>>>
>>> Can this strategy work?
>>
>> there's not a publicly supported feature to "reset" the options right now so 
>> you'd probably need to apply them after you get your window ranging query.   
>>    You can probably remove the effect of eager loaders if you were to just 
>> assign a blank _attributes dictionary to the new query though (just no long 
>> term guarantees).
>>
>> other than that, I use the windowing concept extensively and it works very 
>> well.
> 
> Ok, I will try it.
> 
> Thank you very much for your invaluable insights,
> 
> Ladislav Lenart

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to