As far as I know SqlAlchemy does not use LAST_INSERT_ID() (at least not for single row inserts), At the mysql protocol level, the id created for the auto inc column will be returned for each insert statement (as the result code for that command). The python MySQLdb dbapi driver will make this available trough the property 'lastrowid' on the cursor object. I guess this is wat SA uses. Because the id is returned on the same statement the connection pool will not be a problem.
On Jul 11, 2:18 am, lilo <[EMAIL PROTECTED]> wrote: > According my mysql, LAST_INSERT_ID() is connection specific, so there > is no problem from race conditions. If I insert a record into a > autoincremented table and do last_insert_id() on it, would there be a > possibility where another insert happen just before selecting > last_insert_id(). This won't be a problem with mysql if there isn't > any connection pooling. Since sqlalchemy has support for connection > pooling, would there be a chance where connection is shared with > another insert just before selecting last_insert_id()? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---