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()
self.sm = orm.sessionmaker(bind=self.engine, autoflush=True,
autocommit=False,
expire_on_commit=True)
self.session = orm.scoped_session(self.sm)
In fact I create the entry with the to be logged information
at = AuditTable( info=asdasd, admin=MisterX ... )
Then I add it to my session...
self.session.add(at)
self.session.flush()
self.session.commit()
Now I'd like to calculate a signature for each log entry. The primary
key "id" should also be included in the signature.
But the id is only available after
self.session.flush.
So obviously I need to do an update on the table, to rewrite the
signature to this table entry.
What would be the easiest way to do this?
Kind regards
Cornelius
signature.asc
Description: OpenPGP digital signature
