[GRASS-dev] Python Scripting Library: mogrify command

Massimiliano Cannata massimiliano.cannata at supsi.ch
Tue Jul 12 11:50:50 EDT 2011


Hi,
I was wandering: does exist a python::core function capable to mogrigy 
the inputs of a run_command()?

The mogrify function for psycopg2 is defined as follows:
"/Return a query string after arguments binding. The string returned is 
exactly the one that would be sent to the database running the execute() 
method or similar./"
 >>> cur.mogrify("INSERT INTO test (num, data) VALUES (%s, %s)", (42, 
'bar'))
"INSERT INTO test (num, data) VALUES (42, E'bar')"

...so for GRASS it could be:
 >>> grass.mogrify_command("r.univar",flags="g",map="test")
"r.univar -g map=test"

This could be helpful in debugging....

Maxi



-- 

Dr. Eng. Massimiliano Cannata
Responsabile Area Geomatica
Istituto Scienze della Terra
Scuola Universitaria Professionale della Svizzera Italiana
Via Trevano, c.p. 72
CH-6952 Canobbio-Lugano
Tel: +41 (0)58 666 62 14
Fax +41 (0)58 666 62 09

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-dev/attachments/20110712/9b64232f/attachment.html


More information about the grass-dev mailing list