wiki:SqlQueryMacro

Version 16 (modified by anonymous, 11 years ago) (diff)

--

Execute an SQL Query

Notice: This plugin is unmaintained and available for adoption.

Description

Execute an SQL Query against a configured database displaying a formatted table of results.

See also WikiTableMacro for a simpler implementation, which does not allow to define a datasource.

Bugs/Feature Requests

Existing bugs and feature requests for SqlQueryMacro are here.

If you have any issues, create a new ticket.

Download

Download the zipped source from [download:sqlquerymacro here].

Source

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

Example

This macro can be used in one of two ways:

{{{
#!SQL
SELECT * FROM foo
}}}

or

[[SQL(SELECT * FROM foo)]]

Install

This macro requires the pymills library and makes use of its db and table modules. Please install pymills first.

wget https://bitbucket.org/prologic/pymills/get/0d1424e1b0ab.zip
unzip 0d1424e1b0ab.zip
easy_install $PWD/prologic-pymills-0d1424e1b0ab

To install the macro:

easy_install TracSqlQueryMacro

To enable:

[components]
sqlquery.* = enabled

Configure

To configure this plugin, you must tell sqlquery what database to connect to:

In trac.ini (or via the Web Admin):

[sqlquery]
uri = mysql://user:password@hostname/database

You can also use oracle or sqlite:

uri = oracle://user:password@tns
or
uri = sqlite:///path/to/db

Feedback

Please give your feedback (anything that shouldn't be a ticket) here?

Recent Changes

18071 by rjollos on 2021-03-16 22:34:36
TracSqlQueryMacro 0.3dev: Remove pymills dependency

Patch by Jun Omae.

Fixes #12023.

17555 by rjollos on 2019-11-15 15:28:06
TracSqlQueryMacro 0.2: Fix incorrectly chained methods

Refs #13646.

17554 by rjollos on 2019-11-14 12:17:52
TracSqlQueryMacro 0.2: Use Trac's database API when querying Trac database

Refs #13646.

(more)

Author/Contributors

Author: JamesMills
Maintainer: JamesMills
Contributors: