[sqlalchemy] setting collection backref during merge()

2011-07-06 Thread Kent
If I merge() an object with a collection property, the backref's are not set as they would be if I had assigned the collection to the object. I expected that this should occur. Is there rationale for not setting backref's or would it be possible to make this change? Thanks, Kent -- You

Re: [sqlalchemy] setting collection backref during merge()

2011-07-06 Thread Michael Bayer
A persistent object doesn't populate an unloaded backref on a forward set event. This is for efficiency so that when you do something like: for b in Session.query(B): b.a = some_a it doesn't spend time loading the bs collection of some_a, which if you had a lot of different some_a