# HG changeset patch # User catherine@Elli.myhome.westell.com # Date 1237260641 14400 # Node ID 342e96de6de6730b312fe9023e8723e87f93a906 # Parent 041c656dc8e5c86d40707b3c4f119cc33f4e58f1 json not quite there diff -r 041c656dc8e5 -r 342e96de6de6 sqlpython/output_templates.py --- a/sqlpython/output_templates.py Mon Mar 16 22:20:53 2009 -0400 +++ b/sqlpython/output_templates.py Mon Mar 16 23:30:41 2009 -0400 @@ -14,6 +14,13 @@ """), +'\\j': genshi.template.NewTextTemplate(""" +{"${tblname}_resultset: [{% for row in rows %} + "${tblname}": {{% for (colname, itm) in zip(colnames, row) %} + "${colname.lower()}": "${itm}",{% end %} }, + {% end %}] +}"""), + '\\h': genshi.template.MarkupTemplate(""" diff -r 041c656dc8e5 -r 342e96de6de6 sqlpython/sqlpython.py --- a/sqlpython/sqlpython.py Mon Mar 16 22:20:53 2009 -0400 +++ b/sqlpython/sqlpython.py Mon Mar 16 23:30:41 2009 -0400 @@ -216,6 +216,7 @@ \\G aligned list \\h HTML table \\i INSERT statements +\\j JSON \\s CSV (with headings) \\S CSV (no headings) \\t transposed