Automagically log changes in table

Jorge Godoy jgodoy at
Sun Mar 18 13:53:07 CET 2007

"aspineux" <aspineux at> writes:

> On 18 mar, 04:20, "George Sakkis" <george.sak... at> wrote:
>> I'd rather avoid triggers since I may have to deal with Mysql 4. Apart
>> from that, how can a trigger know the current user ?
> Because each user opening an web session will login to the SQL database
> using it's own login. That way you will be able to manage security at DB
> too. And the trigger will use the userid of the SQL session.

That's not common in web applications (he mentions TurboGears later).  What is
common is having a connection pool and just asking for one of the available
connections, when your app gets it, it just uses it.  After each request this
connection returns to the pool to be reused.

I dunno about SQL Alchemy (also mentioned later), but SQL Object 0.8x has some
events that can be bound so they can act is triggers on your database, but
client side.  Of course they don't have all the context as a real trigger
does, but those might be enough to avoid duplicating lots of code through the
app to set some variable.

Jorge Godoy      <jgodoy at>

More information about the Python-list mailing list