Re: [sqlalchemy] Unnecessary SQL emitted after a commit to get a PK?

2011-01-13 Thread Russ
On Wednesday, January 12, 2011 2:16:00 PM UTC-5, Michael Bayer wrote: Suppose a concurrent thread or process deleted your row in a new transaction and committed it, or didn't even commit yet hence locked the row, in between the time you said commit() and later attempted to access the

[sqlalchemy] Unnecessary SQL emitted after a commit to get a PK?

2011-01-12 Thread Russell Warren
Check this code out: http://python.pastebin.com/kMV611z7 In there I generate an object instance, add it to a session, then commit it. I then try and access the id attribute (autoincrementing PK), which results in SQL being emitted... but the emitted SQL has the id value in it already! Is there

Re: [sqlalchemy] Unnecessary SQL emitted after a commit to get a PK?

2011-01-12 Thread Michael Bayer
Suppose a concurrent thread or process deleted your row in a new transaction and committed it, or didn't even commit yet hence locked the row, in between the time you said commit() and later attempted to access the attributes of the row. That's the rationale in a nutshell. see