I know this isn't the SQLAlchemy list, but I've been designing my resource
tree using SQLAlchemy and traversal for my up coming project. I was thinking
about starting a discussion and possibly getting some help on a problem I'm
having.

I have the Foo resource, which is an object mapped to the foo database
table. Foo has has Bars. Bar is an object mapped to the bar database table.
Bars belong to Foo as a one to many relationship. I am using SQLAlchemy's
relationship() function to map bars to foo.

When I call foo.bars, I need all the Bar objects in the collection to have
the Foo instance as it's __parent__.

Has anyone solved this? I see that relationship() has the collection_class
attribute. I already tried extending list type and overloading the append
and extend methods to set __parent__ and then call super(). It didn't seem
to work as I don't have __parent__ on any of the child Bar instances.

Any help would be appreciated. I would also encourage a discussion on how to
approach this cleanly.

Kyle Terry | www.kyleterry.com

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en.

Reply via email to