What type of concrete objects would you expect the ORM layer to return, if such 
a method call existed?  Outer joins tend to be used for getting mixed tuples of 
data that don't correspond to concrete ORM types.  I can't immediately fathom 
what any ORM's behaviour should be..

What do you mean by "without talking to the data-store directly"?  The only way 
I see to do this is to pass the DM adapter the SQL directly, and process the 
responses as abstract tuples of data (you'll get back an array).  You could 
hydrate objects yourself manually from there, but YMMV: with any kind of outer 
join you can end up with nulls, and extra check-fields-before-hydration logic 
would be crappy to deal with (and why bother - this is DM's job to begin with).

FWIW, you might consider using direct SQL to conduct your outer join(s) and 
only retrieve primary keys, then use the ORM to hydrate the objects akin to 
User.all(:id => [..]).

cheers,
--jordan


On Dec 7, 2011, at 1:07 PM, terminal_breaker wrote:

> Is there a way to do left outer joins in Datamapper without having to
> resort to talking to the data-store directly. I've been searching the
> net and the Datamapper docu with not success on details how to do so.
> 
> For example:
> 
> SELECT p.user_id, p.description, u.user_name
> FROM privileges p
> LEFT OUTER JOIN users u ON (p.user_id = u.id)
> WHERE p.description = "delete rights"
> 
> And let's say that I have a User class and a Privilege class too.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "DataMapper" 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/datamapper?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" 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/datamapper?hl=en.

Reply via email to