Hello,

What I'm trying to do is get the primary key for a brand new object at the time I create it, rather than when I call objectstore.commit(). I need the identifier when I create the object for logging, and messaging purposes (amongst others). I don't want to commit the transaction at this point, but I would like to have the resultant object to be in 'sync' with the object store. This is what I did to make that work:


User.mapper.table.insert(userDict).execute()
id = engine.last_inserted_ids()[0]
user = User.mapper.get(id)

Is there an easier way to do this that I totally missed?

Would it be possible to have a newly created object grab the next sequence value at instantiation time or be able to create an object and explicitly 'save' it? Save would mean, execute it's insert statements against the database but not commit the transaction. Thanks.

Aaron


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to