[sqlalchemy] Re: Possible autoflush error when using backreferences to fill in multiple db required fields

2009-07-13 Thread rledley
Thank you for such a quick reply! I thought I might have to do something like that. Could you explain, though, for my own understanding, why the exception isn't raised the first time a Lesson is referenced through a backref? It's missing required fields at that point, so one would expect this

[sqlalchemy] Re: Possible autoflush error when using backreferences to fill in multiple db required fields

2009-07-13 Thread Michael Bayer
rledley wrote: Thank you for such a quick reply! I thought I might have to do something like that. Could you explain, though, for my own understanding, why the exception isn't raised the first time a Lesson is referenced through a backref? It's missing required fields at that point, so one

[sqlalchemy] Re: Possible autoflush error when using backreferences to fill in multiple db required fields

2009-07-10 Thread Michael Bayer
you can disable autoflush temporarily (session.autoflush=False), turn off save-update cascade on the collection relations so that you add the Lesson manually, or instantiate Lesson using the backrefs to set it up, i.e. Lesson(obj1=someobject, obj2=someotherobject), so that upon construction the

[sqlalchemy] Re: Possible autoflush error when using backreferences to fill in multiple db required fields

2009-07-10 Thread Michael Bayer
or you can use lazy=dynamc on those collections so that they only load when iterated. On Jul 10, 2009, at 9:14 PM, Michael Bayer wrote: you can disable autoflush temporarily (session.autoflush=False), turn off save-update cascade on the collection relations so that you add the Lesson