Don't close the db connection after each SQL command is executed. In Trac 0.12 this causes subsequent db queries to have no connection, causing AttributeErrors.
--- tracsqlhelper/__init__.py (revision 8119)
+++ tracsqlhelper/__init__.py (working copy)
@@ -29,10 +29,10 @@
Exception:%s""" %(sql, params, e))
+ # db.close()
+ # pass
AFAICT this is a band-aid over a bigger issue. SQLHelperScript does not distinguish between commands that write to the db and commands that only read from it -- all commands will commit and roll-back the database. It also tries to manage its own database connections (get_db_cnx and the now-commented-out db.close()). And in fact it seems like as of Trac 0.12 it should not be trying to manage its own transactions either, or if it does it should be using the with_transaction decorator. But my hunch is that none of this should be managed at the level of the individual SQL command
objects, rather by their callers.
Regardless this small change seems to fix the immediate issue, comment:4:ticket:7182-- though I don't know if it will cause additional problems.