On Mar 8, 2007, at 11:22 AM, Jonathan Ellis wrote:

>
> On 3/8/07, Michael Bayer <[EMAIL PROTECTED]> wrote:
>>
>> hey list -
>>
>> I continue to be troubled by the slightly fragmented nature of SA's
>> Query object (and the cousin SelectResults).  When I work with
>> Hibernate, I can see that their querying interface is a little more
>> consistent than ours.  We have flags that are used for some things,
>> generative methods for others.
>>
>> so id like to look into defining the next generation of query.  Id
>> like it to have a "quasi-generative" approach, like Hibernates.  this
>> means you can say:
>>
>>    q = q.where(<something>).order_by(<somethingelse>)
>>
>> but also, its the same as:
>>
>>    q.where(<something>)
>>    q.order_by(<somethingelse>)
>>
>> so its really the same instance (this is not how SelectResults works
>> at the moment).
>
> I like the select results way better.  That way you can make a "base
> query" and then modify it easily; if you're modifying in place, and
> you add another where clause, you can't easily re-use the pre-modified
> version again.

how often do you have a "base query" hanging around, vs. doing "brand  
new query object" each time?  with the full "generative" way, if you  
are programatically building up your query, now you have to say:

if somecriterion:
     q = q.where(<something>)
if someother criterion:
     q = q.where(<somethingelse>)

q = q.order_by(<something else>)
q = q.options(foo)

ie you have to keep remembering to say "q = q.etc", otherwise you are  
just throwing away your newly generated query objects.  this seems  
inconvenient to me.

id like to see what cases make you want to have a base query that is  
reused, and consider how that might not be needed either.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to