[[PageOutline(2-5,Contents,pullout)]] = Execute an SQL Query from within Trac == 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: * SqlAlchemyQueryMacro: a plugin that supersedes !SqlQuery. * WikiTableMacro: a simpler implementation, which does not allow to define a datasource. == Bugs/Feature Requests Existing bugs and feature requests for SqlQueryMacro are [report:9?COMPONENT=SqlQueryMacro here]. If you have any issues, create a [/newticket?component=SqlQueryMacro new ticket]. == Download Download the zipped source from [export:sqlquerymacro here]. == Source You can check out SqlQueryMacro from [/svn/sqlquerymacro here] using Subversion, or [source:sqlquerymacro browse the source] with Trac. == Installation To install the macro: {{{#!sh $ pip install TracSqlQueryMacro }}} To enable in your `trac.ini` file: {{{#!ini [components] sqlquery.* = enabled }}} == Configuration Configuration is only needed for the 0.11 branch of the plugin, or if using a datasource other than Trac's database. To configure this plugin, you must tell SQLQuery what database to connect to. In `trac.ini` or via the WebAdmin menu: {{{#!ini [sqlquery] uri = mysql://user:password@hostname/database }}} You can also use Oracle or SQLite: {{{#!ini [sqlquery] uri = oracle://user:password@tns }}} or: {{{#!ini [sqlquery] uri = sqlite:///path/to/db }}} == Example This macro can be used in one of two ways: {{{ {{{#!SQL SELECT * FROM component }}} }}} or: {{{ [[SQL(SELECT * FROM component)]] }}} == Recent Changes [[ChangeLog(sqlquerymacro, 3)]] == Author/Contributors '''Author:''' JamesMills [[BR]] '''Maintainer:''' [[Maintainer]] [[BR]] '''Contributors:'''
E-mail address and name can be saved in the Preferences.