QueryDb

Purpose

The purpose of this macro is to query a postgresql database.

Download & Release Notes

Download

Release Version

Moin Version

Release Notes

QueryDb-1.3.py

1.3 and Above

First release on MacroMarket -- IgorTamara 2006-04-08 05:19:27

QueryDb-1.9.py

1.9

UTF-8 support -- IgorTamara 2013-05-12 05:19:27

You can grab the most recent version from BitBucket

Requisites

Inputs

Receives as a single argument the query.

Output

Examples

<<QueryDb(SELECT name FROM countries)>>

would fetch every name of the table country ;) and if there are results it will present the results in a table.

There are <<QueryDb(SELECT count(*) from queries)>> query records
would inline the result on your wiki code.

Improvements

If you plan to use multiple wikis or multiple databases, you could create a separate file with dictionaries of identifiers and string connections, as a first input you would receive the key of the dictionary that will let you connect to the desired database, the second argument would be the query.

Recommendations

Create a reading user on your database, people looking with ?action=raw could deduce your database, if you are not concerned about security don't bother. Remember that anyone with write access to your wiki could do a nasty sql query to slow down you or D.O.S. attack your system.

IgorTamara - <igor AT tamarapatino DOT org>

License

GNU GPL version 2

Bugs

Discussion

MoinMoin: MacroMarket/QueryPg (last edited 2013-05-12 21:00:28 by IgorTamara)