On Aug 11, 2010, at 1:55 PM, Michael Bayer wrote: > > What is implied by relationship() is that you're joining and limiting a full > set of records using a join condition. This implies that the mapped > selectable would be returning a set of rows corresponding to all possible > child collections, not just the collection of a single parent based on a > bind. So here you'd perhps have to wrap your function into a correlated > subquery to produce that effect, or rewrite the function so that it returns > all possible child collections with an extra set of columns indicating those > of the parents. There is a recipe to get binds into a relationship, but not > for this same use case, at > http://www.sqlalchemy.org/trac/wiki/UsageRecipes/GlobalFilter - it probably > is also not what you're looking for here.
der well let me correct myself - you really want the parent column to be present in your function call, not a bind. the "bind" part of things happens when the lazy loader goes thorugh the join condition and converts places where the parent.id is located into the bind. So if you make your selectable against func.myfunc(parent_table.c.id), then perhaps correlate(parent_table.c.id) to make sure it doesnt get put in the FROM, then use the mapper hack in #1876, maybe that works for the eagerload/join case as well. -- 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.
