Thanks all for the responses. It's been very enlightening.

On Dec 7, 4:26 pm, Ted Han <[email protected]> wrote:
> I've got a patch somewhere that allows one to patch in different types of 
> joins, but i never merged it in because it breaks the abstraction :\
>
> i'll try to dig it up when i get home (which won't be for a while yet).
>
> --
> Ted Han
> @knowtheory (http://twitter.com/knowtheory)
> DocumentCloud
> Investigative Reporters & Editors
>
>
>
>
>
>
>
> On Wednesday, December 7, 2011 at 4:24 PM, Jordan Ritter wrote:
> > Well then I think Chris' adapter might be the most concise approach to try, 
> > assuming you match the side/type of outer join with the model you're 
> > hydrating.
>
> > cheers,
> > --jordan
>
> > On Dec 7, 2011, at 2:13 PM, terminal_breaker wrote:
>
> > > > What do you mean by "without talking to the data-store directly"?
>
> > > The phrase 'talking to the data-store directly' is from the online
> > > Datamapper documentation under the section titled 'Talking directly to
> > > your data-store':http://datamapper.org/docs/find.html
>
> > > > I can't immediately fathom what any ORM's behaviour should be
>
> > > In ActiveRecord I can create outer joins using sql fragments:
>
> > > Privilege.select("privileges.user_id, privileges.description,
> > > users.user_name ").joins('LEFT OUTER JOIN users ON privileges.user_id
> > > = users.id').where("privileges.description = 'delete rights' ")
>
> > > This would return to me an ActiveRecord object.
>
> > > On Dec 7, 3:40 pm, Jordan Ritter <[email protected] 
> > > (http://darkridge.com)> wrote:
> > > > 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] 
> > > > > (mailto:[email protected]).
> > > > > To unsubscribe from this group, send email to 
> > > > > [email protected] 
> > > > > (mailto:[email protected]).
> > > > > For more options, visit this group 
> > > > > athttp://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] 
> > > (mailto:[email protected]).
> > > To unsubscribe from this group, send email to 
> > > [email protected] 
> > > (mailto:[email protected]).
> > > For more options, visit this group 
> > > athttp://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] 
> > (mailto:[email protected]).
> > To unsubscribe from this group, send email to 
> > [email protected] 
> > (mailto:[email protected]).
> > For more options, visit this group 
> > athttp://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