sql query results to xml (fwd)

Dr. David Mertz mertz at gnosis.cx
Sun Mar 11 22:46:30 EST 2001


Scott Hathaway wrote:
> I want to create a tool that will take a valid SQL query and return the
> results as valid xml.  Before I reinvent the wheel, is there a python class
> or code snippet that someone has that does this already?

Uche Ogbuji <uche at ogbuji.net> responded:
|Not that I know of.  Are you planning to use the syntax from Oracle's
|XSQL, or DB2's XML Extender, or any of the other hundreds of formats
|available (see
|http://www.linuxworld.com/lw-2001-02/lw-02-xml3databases.html
|But all that is just to point out that you probably don't have to
|reinvent a resultant XML format.

Before anyone *does* decide to roll-their-own version of this, I wanted
to mention that Scott Hathaway and I are working on a pair of tools in
answer to Scott's original inquiry.  Consider this preliminary, but my
little bit can be seen at:

  http://gnosis.cx/download/sql2dtd.py

A *likely* output file (partially hand done) can be found at:

  http://gnosis.cx/download/sql2xml_sample.xml

I've looked at a version of Scott's sql2xml.py portion of things, but am
not sure if he wants to make that available quite yet.

Anyway, it will be a matter of just a few days before we'll have a
fairly reasonable Python solution to the (small) problem above.
Hopefully, it will be useful to some developers.

However, contrary to Uche's no-doubt-sound advice, our stuff is a brand
new format, not any of those referenced by Uche's article.  The choices
are straightforward and obvious, but presumably not *identical* to other
systems.

Yours, David...




More information about the Python-list mailing list