Adding custom reports to trac

July 7, 2008

Since the doco doesn’t give quite enough help to be fully useful, here’s some incremental additional guidance. To add custom reports to trac you’ll need to monkey with the database – the report queries are stored there.

  • Start by backing the db up.
  • If you’re using sqlite (the default) and you don’t want to stop the trac server to use one of the client tools, you’ll probably want to access the db through the python api, as per the advice here.
  • You need to execute an insert statement to make your query. You’ll need to do the triple quote dance, since you’re adding a SQL query as a value in a SQL query, inside a string parameter to the cursor.execute() method. The doco on creating reports has advice on the schema.
  • Remember to call db.commit(), since sqlite seems to lock reads when there are outstanding write transactions open.

Free advice, and worth what you paid.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: