Helper functions to abstract the Trac SQL API

Notice: This plugin is unmaintained and available for adoption.


While there is considerable contention on the subject, I am one of those people that doesn't like to see SQL statements in Python code (or C code, etc). I especially don't like it when the same basic statements are repeated all over the place. So TracSqlHelperScript is my attempt to encapsulate all of this logic in one place. These are functions I've already co-written for the TracHoursPlugin and then rewritten (some of them) for the GeoTicketPlugin. Instead of rewriting them again for yet another plugin where I want this functionality, I'm making a library out of them which hopefully I will backport to those plugins.

I'd really like a better story for this in general, like having at least some of these convenient functions on the database cursor. But quite frankly, I'm not an SQL expert, and IMHO it would be better for Trac to completely abstract its backend, so I'll leave whatever action for those that know better and stick with this library for my purposes.

See the GeoTicketPlugin and the TracHoursPlugin for how these functions are used. Essentially, they are to help build new plugins with when you want to have a slightly abstracted database layer. I'd love help with this, if anyone would like to contribute.

Bugs/Feature Requests

Existing bugs and feature requests for TracSqlHelperScript are here.

If you have any issues, create a new ticket.


3 / 3


1 / 1


Download the zipped source from here.


You can check out TracSqlHelperScript from here using Subversion, or browse the source with Trac.


General instructions on installing Trac plugins can be found on the TracPlugins page.

Recent Changes

16473 by rjollos on 2017-04-05 02:57:40
TracSQLHelper 0.3.1: Replace use of remove _get_connector
14299 by rjollos on 2014-12-05 10:07:30
0.3.0: New branch compatible with Trac 1.1.2 and later. Fixes #12090.
12983 by rjollos on 2013-04-19 16:04:44
Refs #7262: Bump version of 0.12 branch, so that it differs from the 0.11 branch following [8159].


Author: k0s
Maintainer: none (needsadoption)

Last modified 6 years ago Last modified on Jun 6, 2018, 6:12:06 AM