wiki:SqlQueryMacro

Execute an SQL Query from within Trac

Notice: This plugin is deprecated in favor of SqlAlchemyQueryMacro.

Description

This plugin allows you to execute an SQL Query against a configured database displaying a formatted table of results from within Trac.

See also:

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 here.

Source

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

Installation

This macro requires the pymills library and it 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 in your trac.ini file:

[components]
sqlquery.* = enabled

Configuration

To configure this plugin, you must tell SQLQuery what database to connect to.

In trac.ini or via the WebAdmin menu:

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

You can also use Oracle or SQLite:

[sqlquery]
uri = oracle://user:password@tns

or:

[sqlquery]
uri = sqlite:///path/to/db

Example

This macro can be used in one of two ways:

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

or:

[[SQL(SELECT * FROM foo)]]

Feedback

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

Recent Changes

14239 by rjollos on 2014-11-04 13:21:22
Import of Connection fails, at least in the most recent version of pymills. Refs #12023.

Patch by paresh138@….

14238 by rjollos on 2014-11-04 13:21:18
Added pymills to installation requirements.
14237 by rjollos on 2014-11-04 13:21:15
Removed unused ITemplateProvider implementation.
(more)

Author/Contributors

Author: JamesMills
Maintainer: Ryan J Ollos
Contributors:

Last modified 5 months ago Last modified on Dec 15, 2015, 4:49:41 AM