One of the ideas I most gleefully stole from YASQL for sqlpython is special terminators, sequences like
\g
and \c
that replace a SELECT statement's ending semicolon. When a query ends with a special terminator, the output is specially formatted: \c
gives CSV, \h
gives HTML, \t
gives transposed (columns as rows / rows as columns), etc. Type help terminators
for details.sqlpython 1.5.0 is out today, with the most demented special output format yet: CHARTS! Instant ad-hoc grapical goodness direct from your query, no tedious mucking around in spreadsheets or exporting to another program. Just terminate your query with \l (line graph), \L (scatter graph - no lines), \p (pie chart), or \b (bar graph).
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgud7rWjI2x8-H8Ixm5iq42E89Lz_wdBUG9qs1HBFmVNzT9x_fV3p03RFmZuU7Jx58g7u5bdoiRuPwpuLC1DrFJiOO2Fdhz7QC8o3zAkK8d-95g3wVvb2zmGAfjVh5VWXQqx8mRmQ/s320/bar.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMcHfhYo8zisC3SSEHyErloXB3EtEzx-Er4D7d6uaWgyxD2K0wEsnq7cFwPssa3LTV2bvvkHStRqFvS7U9NdoXdRmhVIIPWB2F5N4HsjXIYI2Pn_22SAmDyD00Oi_Kqg26mRw46A/s320/pie.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsPLYfCbAibV0MNf3V1UuCVcjTXP99QZxYQWg7HniJcgjaSyy_y2QRLpDpZ5SYCysb6dnWnU6xet-jXoRp8_Thjy0gcPUL8O1p34LyNZ0zZDcqadJxdKJe99aR7QTQjq5t70yHKA/s320/line.png)
Also, as of 1.5.0, it's pretty easy to define your own special terminators and formats. Just install sqlpython in uncompressed form (easy_install -UZ will do that), open up output_templates.py, and follow the pattern.
5 comments:
Good stuff--thanks for sharing.
Hi Catherine,
I really like this latest addition to sqlpython. Very well done!
Cheers,
Luca
Instant thought - sqlpython doesn't seem to display stuff printed with dbms_output. Have I just missed an option that I need to set? (The documentation seems a bit hard to locate).
You're right, Paul, dbms_output isn't working yet. Sadly, I don't even know how to make it work. I'm eager for any suggestions...
Indeed that's an interesting question. I see from this post on asktom a possible solution related to the jdbc clients which may give some ideas: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:45027262935845
Post a Comment