Display a table in a wiki page

Notice: This plugin is unmaintained and available for adoption.


This is a macro that enables you to place tables resulting from SQL queries into a Trac wiki page. It supports the following functionalities:

  • SQLTable, which returns the result set of the SQL query that follows it.
  • SQLScalar, which returns the single value that is the result of the SQL query that follows it.

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.

See also WikiReportMacro.

Bugs/Feature Requests

Existing bugs and feature requests for WikiTableMacro are here.

If you have any issues, create a new ticket.


7 / 8


8 / 10


4 / 4


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 pip install svn+
  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

18622 by jun66j5 on 2024-02-26 11:46:22
WikiTableMacro 0.3dev: fix compatible with Python 3
18458 by rjollos on 2021-12-14 15:55:25
WikiTableMacro 0.3dev: Make exception handling Py3 compatible

Refs #14101.

16994 by rjollos on 2017-11-20 00:43:24
WikiTableMacro 0.3: Release version 0.3

Fixes #13336.



Author: optilude
Maintainer: none (needsadoption)
Contributors: jun66j5

Last modified 4 years ago Last modified on Apr 18, 2020, 12:22:46 PM