PyGreSQL and HTML

Tim Roberts timr at probo.com
Wed Jan 15 08:28:18 CET 2003


Dave Roberts <dvrbts at nr.usu.edu> wrote:

>Does anyone know how to shift postgres into html table mode from inside
>PyGreSQL?
>
>From inside postgres it's simple:  \pset format html

That is NOT used "from inside postgres".  Rather, it is used inside psql,
which is a completely separate command-line utility that happens to talk to
the postgres server, just as PyGreSQL does.

>However, all my attempts to pass postgres that string from inside
>PyGreSQL seem to get trapped by the interpreter.  I'm trying to use
>python cgi scripts to present queries, and since the output is going to
>stdout (the browser), if I could just kick postgres into html it would
>be self-presenting.

Right.  Postgres doesn't understand the backslash commands, psql does.  You
are talking directly to postgres, so you will have to do the formatting
yourself.
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.




More information about the Python-list mailing list