On Nov 11, 2006, at 8:11 PM, Daniel Miller wrote:

> Yes, for Table objects that works fine, but I'm talking about  
> joining mapped classes. Does that make sense? Is it possible to do  
> join(Entity1, Entity2, onclause) where EntityX is a class with a  
> mapper? It certainly would not be acceptable to automatically add  
> join(), outerjoin(), etc. methods to all mapped classes since that  
> would be a serious invasion of user-defined namespaces (SA puts all  
> kinds of private stuff in there, but 'c' and 'mapper' are the only  
> attributes that I know of that are not private that get added to  
> mapped classes).
>

problematic using a free-standing function like "join" is that the  
sqlalchemy namespace already has a "join" which deals with tables,  
and is in the sql module.   people usually import the entirety of SA  
as a single namespace (even though you can import sql and orm  
separately).   I would not want that join() to know anything about  
the ORM since that would badly violate encapsulation.  also mapping  
classes to tables on the fly like that makes it hard to specify  
alternate mappings, such as via entity-name or non_primary=True mappers.

theres a philosophical undercurrent here as well that states that "if  
you are constructing SQL, you work with SQL constructs", which  
implies that if you are doing a relational query, your application is  
aware of the actual Table objects.   Thats the current paradigm  
behind Query.   Coming up with an object-level query language is  
another paradigm, and i think if we want to try another paradigm, it  
would be better explored as its own module, at least for starters.   
That way the new method could be exactly what it wants to be, which  
id imagine might be a whole new DSL that mimics hibernate's HQL,  
without needing to tiptoe around the current ways of doing things  
with Query.

in any case i think its something that needs to be implemented a  
little bit before we keep hypothesizing about it.








--~--~---------~--~----~------------~-------~--~----~
 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