Attach to SQL Alchemy event handling to work around sqlite3 bug