return sql query in xml format in python

Posted by Ramy on Stack Overflow See other posts from Stack Overflow or by Ramy
Published on 2010-06-01T19:14:00Z Indexed on 2010/06/01 19:53 UTC
Read the original article Hit count: 345

Filed under:
|
|
|

When I first started working at the company that i work at now, I created a java application that would run batches of jasper-reports. In order to determine which parameters to use for each report in the set of reports, I run a sql query (on sqlserver). I wrote the application to take an xml file with a set of parameters for each report to be generated in the set. so, my process has become, effectively, three steps:

  1. run the sql query and return the results in XML format (using 'for XML auto')
  2. run the results of the sql query through an XSLT transformation so the xml is formatted in such a way that is friendly with the java application i wrote.
  3. run the java application with that final xml file

As you can imagine, what I'd like to do is accomplish these steps in python, but i'm not quite sure how to get started. I know how to run an SQL query in Python. I see plenty of documentation about how to write your own xml document with Python. I even see documentation for xsl transformations in python.

the big question is how to get the results of the sql query in XML through python. Any and all pointers would be very valuable. Thanks, _Ramy

© Stack Overflow or respective owner

Related posts about python

Related posts about sql