[sqlalchemy] model root object in container hierarchy

2009-11-17 Thread fogathm...@googlemail.com
Hello! I want to introduce an artificial root object into my model to obtain a traversable container hierarchy: class Root: foos = [] bars = [] Foo and Bar are both mapped classes and I had hoped to be able to do something like mapper(Root, properties=dict(foos=relation(Foo),

[sqlalchemy] backref vs. back_populate

2009-10-16 Thread fogathm...@googlemail.com
Hello! From reading the docs, I assumed that using backref on the child's orm.relation declaration in a 1:n relationship is equivalent to using back_populates with explicit orm.relation declarations on both ends. However, it turns out that I get double insertions when using back_populates - so,

[sqlalchemy] Re: backref vs. back_populate

2009-10-16 Thread fogathm...@googlemail.com
On Oct 16, 12:50 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Oct 16, 2009, at 4:43 AM, fogathm...@googlemail.com wrote: Hello! From reading the docs, I assumed that using backref on the child's orm.relation declaration in a 1:n relationship is equivalent to using

[sqlalchemy] Re: backref vs. back_populate

2009-10-16 Thread fogathm...@googlemail.com
On Oct 16, 5:18 pm, Michael Bayer mike...@zzzcomputing.com wrote: fogathm...@googlemail.com wrote: Ah, thanks, that makes sense. So I was wrong in assuming the two forms were equivalent - backref merely allows you to access a relation from the other side, whereas back_populates performs