[sqlalchemy] searching for new objects not yet in database

2010-11-12 Thread thatsanicehatyouhave
Hi, I just want to check on something. Let's say I've got a script that's populating a database and will commit the transaction at the end. It looks for a particular object (let's call it A), and if NoResultFound it creates a new object and does a session.add(A). What if in a later iteration

Re: [sqlalchemy] searching for new objects not yet in database

2010-11-12 Thread Michael Bayer
On Nov 12, 2010, at 7:32 PM, thatsanicehatyouh...@mac.com wrote: Hi, I just want to check on something. Let's say I've got a script that's populating a database and will commit the transaction at the end. It looks for a particular object (let's call it A), and if NoResultFound it creates

Re: [sqlalchemy] searching for new objects not yet in database

2010-11-12 Thread thatsanicehatyouhave
Thanks for the quick reply! On Nov 12, 2010, at 7:41 PM, Michael Bayer wrote: mm, right there that's not the default behavior. If you did an add(A), the next query() you do will autoflush. A is now in the database within the scope of the current transaction, so query() will find it. Yes,

Re: [sqlalchemy] searching for new objects not yet in database

2010-11-12 Thread Michael Bayer
On Nov 12, 2010, at 7:49 PM, thatsanicehatyouh...@mac.com wrote: Thanks for the quick reply! On Nov 12, 2010, at 7:41 PM, Michael Bayer wrote: mm, right there that's not the default behavior. If you did an add(A), the next query() you do will autoflush. A is now in the database within