Display a table in a wiki page


This is a macro that enables you to place tables resulting from SQL queries into a Trac wiki page.

Use the SQLTable macro as follows:

SELECT COUNT(id) AS "Number of Tickets"
FROM ticket

The result will be a table displayed in a html page.

You can also use wiki markup in the table:

SELECT '[milestone:' || name || ' ' || name || ']' AS name, due, completed, description
FROM milestone 

Use the SQLScalar macro:

SELECT COUNT(id) AS "Number of Tickets"
FROM ticket

The result will be a single number.

It is similar to, but simpler than, SqlQueryMacro or SqlAlchemyQueryMacro. The main differences are that it has fewer dependencies and only queries the Trac database, rather than requiring you to set up a separate database connection.

Bugs/Feature Requests

Existing bugs and feature requests for WikiTableMacro are here.

If you have any issues, create a new ticket.


6 / 6


5 / 8


3 / 3


Download the zipped source from here.


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


  1. Install globally:
    sudo easy_install
  2. Enable the plugin by updating TracIni file (conf/trac.ini):
    wikitable.* = enabled
  3. Restart web server on command line:
    sudo /etc/init.d/apache2 restart

Recent Changes

14734 by rjollos on 2015-06-23 00:53:59
0.3dev: Partial revert of [14524]. Refs #11708.

Reverts to format_to_html but adds CSS to shrink the cell margins.

14531 by rjollos on 2015-04-13 21:24:22
0.3dev: Fix issue fetching from cursor on MySQL.

Patch by theYT <dev@…>. Fixes #12269.

14524 by rjollos on 2015-04-09 02:08:20
0.3dev: Use Trac 1.0 DB API.

  • Macro now requires Trac 1.0 and later.
  • Genshi is used to construct the table.
  • Queries can use non-ASCII table names. Fixes #11708.
  • Read-only database connection is used.

Please report any issues with the latest changes.



Author: optilude
Maintainer: Ryan J Ollos
Contributors: jun66j5

Last modified 4 weeks ago Last modified on Sep 23, 2016, 12:56:10 AM