"SELECT LAST_INSERT_ID()" is ultimately where the value comes from - the raw 
.lastrowid is present on the ResultProxy for those DBAPIs which support it, so 
try using that.   Perhaps you're getting "0" because the transaction is going 
away, in which case .lastrowid should solve that issue.


On Sep 15, 2010, at 12:45 PM, phasma wrote:

> I've got database with auto increment column called `id` and INSERT
> query, whom I need to execute without model declaration in project.
> meta.Session.execute() returns ResultProxy, but last_inserted_ids()
> doesn't work with execute() and "SELECT LAST_INSERT_ID()" statement
> sometimes return 0. Is there any other way to fetch last inserted id ?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to