[[PageOutline(2-5,Contents,pullout)]] = Execute an SQL query == Description Execute an SQL Query against a configured database displaying a formatted table of results. == !Bugs/Feature Requests Existing bugs and feature requests for SqlAlchemyQueryMacro are [report:9?COMPONENT=SqlAlchemyQueryMacro here]. If you have any issues, create a [http://trac-hacks.org/newticket?component=SqlAlchemyQueryMacro new ticket]. == Download Download the zipped source from [export:sqlalchemyquerymacro here]. == Source You can check out SqlAlchemyQueryMacro from [http://trac-hacks.org/svn/sqlalchemyquerymacro here] using Subversion, or [source:sqlalchemyquerymacro browse the source] with Trac. SqlAlchemyQueryMacro comes with sortable tables using http://www.kryogenix.org/code/browser/sorttable/ == Installation General instructions on installing Trac plugins can be found on the [TracPlugins#InstallingaTracplugin TracPlugins] page. his macro requires the python-sqlalchemy ​library and makes use of its db and table modules. Please install python-sqlalchemy first. After getting the source you will have to edit {{{ install_sqlalchemyquery.bash }}} to your needs, you can change: {{{ TRAC_PATH_REPLACE="/path/to/your-trac-environment" #absolute path to your trac environment MAX_ROW_COUNT_REPLACE="1000" # maximum numbers of rows for the query result to display TABLE_BORDER_REPLACE="border=\"1\"" # set the border with of the table }}} To install the macro: {{{ tar -zxvf SqlAlchemyQuery.tar.gz cd SqlAlchemyQuery --- edit install_sqlalchemyquery.bash --- ./install_sqlalchemyquery.bash }}} or with svn: {{{ svn checkout http://trac-hacks.org/svn/sqlalchemyquerymacro cd sqlalchemyquerymacro/1.0/ --- edit install_sqlalchemyquery.bash --- ./install_sqlalchemyquery.bash }}} To enable, in trac.ini: {{{ [components] sqlalchemyquery.* = enabled }}} == Configure To configure this plugin, you must tell sqlquery what database to connect to: In trac.ini : {{{ [sqlalchemyquery] uri = mysql://user:password@hostname/database }}} You can also use oracle or sqlite: {{{ uri = oracle://user:password@tns or uri = sqlite:///path/to/db }}} == Recent Changes [[ChangeLog(sqlalchemyquerymacro, 3)]] == !Author/Contributors **Author:** [wiki:fvdberg] [[BR]] **Maintainer:** [[Maintainer]] [[BR]] **Contributors:**