[sqlalchemy] update table row immediately after writing

2011-05-30 Thread Cornelius Kölbel
Hello, I am using sqlalchemy with pylons. I write audit log messages to table. I use the orm to map my table to my class. orm.mapper(AuditTable, audit_table) self.engine = create_engine(connect_string) metadata.bind = self.engine metadata.create_all()

Re: [sqlalchemy] update table row immediately after writing

2011-05-30 Thread Cornelius Kölbel
OK, after some more reading and thinking, I think i managed it this way: self.session.add(at) self.session.flush() # At this point at contains the primary key id at.signature = self._sign( at ) self.session.merge(at) self.session.commit() Kind

Re: [sqlalchemy] update table row immediately after writing

2011-05-30 Thread Mike Conley
2011/5/30 Cornelius Kölbel cornelius.koel...@lsexperts.de OK, after some more reading and thinking, I think i managed it this way: self.session.add(at) self.session.flush() # At this point at contains the primary key id at.signature = self._sign( at )