On Jun 19, 2007, at 1:43 PM, Jonathan Ellis wrote:

>
> On 6/11/07, Michael Bayer <[EMAIL PROTECTED]> wrote:
>> secondly: a non-primary mapper is just an awkward way of defining an
>> ORM query.  Since we support generative queries now, you can just
>> make a Query object with the criterion youre looking for and just
>> hold onto it...youre just adding a single WHERE criterion, so
>> my_secondary_query = query(MyClass).filter(table.c.tipo=='p').  much
>> easier.   ideally Query should be replacing 90% of all non_primary
>> mapper use cases.
>
> So in your mind, is my non-primary example over at
> http://spyced.blogspot.com/2007/01/why-sqlalchemy-impresses-me.html
> part of the other 10%?  I don't think holding onto a query is as
> elegant as being able to say "user.max_order" in a eager or lazy
> context and having that Just Work, but maybe I am missing something.

your blog post is the other 10% :)

pretty much, the only time non-primary mapper provides anything that  
Query currently does not is if you make a relationship *to* the non- 
primary mapper.

however, it would be nice to totally get rid of non-primary mappers  
because they are usually the wrong path to take, and they are so much  
like a Query.    ideally, mappers shouldnt have anything to say about  
"how its loaded", just "how its represented in the database".  (this  
is why i like our low version numbers.  if we ever get to the 0.7s,  
0.8s etc. these roles would hopefully be rock solid).

the only thing you are getting in your particular example is the  
ability for the relationship to get bundled into an eager load.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
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