MySQL -->Python-->XML for JSviz

Sells, Fred fred at adventistcare.org
Tue Jul 3 18:13:30 CEST 2007


Sometimes sneaky is better than elegant.  You could shell down to a command
line invocation of mysql and specify -xml as the output format.  I'm not
sure how close that format is to what you need or how much you could
leverage views (if using mysql 5.0). You could also use a command line xslt
processor to then redefine your xml output.  That way your data extraction
is one task and you could have many xsl files to convert as needed.

I have used parts of this technique and found it easy to create and debug;
but I have not used the xml output option of mysql.

I'm sure others will point out many excellent xml modules.

> -----Original Message-----
> From: python-list-bounces+frsells=adventistcare.org at python.org
> [mailto:python-list-bounces+frsells=adventistcare.org at python.org]On
> Behalf Of Picio
> Sent: Tuesday, July 03, 2007 10:08 AM
> To: python-list at python.org
> Subject: MySQL -->Python-->XML for JSviz
> 
> 
> Hello all, I need some advice to choose an xml generator for jsviz a
> tool in javascript to create some wonderful graphs (SnowFlake or Force
> directed).
> 
> Starting from a SQL table (mysql) I need to create a XML file with a
> structure like this:
> <node root....>
>       <node id... text... ></node>
>       <node id... text... ></node>
>       <node id... text... ></node>
>                   <node id... text... ></node>
>                   <node id... text... ></node>
>       <node id... text... ></node>
> </node>
> 
> Where nodes attributes are the MySQL table fields (the PK will be the
> attribute).
> I know there are a lot of good tools to do this in pyhton (some maybe
> is already shipped with pyton itself), but since I need a lot of
> flexibility for the future I'd like to use an Object relational mapper
> like SQLAlchemy or SQLObject todo the job. When I say flexibility, I
> have in mind a solution to have multiple formats coming outside of the
> ORM:
> json, csv, plain text etc...
> Am I wrong?
> Can someone advice something?
> 
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 



More information about the Python-list mailing list