It seems cx_Oracle doesn't.
Any other suggestion for handling xml with Oracle and Python is appreciated.
Thanks.
It seems cx_Oracle doesn't.
Any other suggestion for handling xml with Oracle and Python is appreciated.
Thanks.
(edited to remove mention of a non-Oracle Python DB-API module and add some more relevant and hopefully useful info).
Don't know of any alternative to cx_oracle
(as the DCOracle2 author says, "DCOracle2 is currently unmaintained, and no support is available." so it's not really an alternative).
However, a recent article on Oracle's own site asserts that (at least with recent releases such as Oracle 10g XE -- and presumably recent cx_oracle releases) Python can work with Oracle's XML support -- I don't know if the examples in that article can help you address your issues, but I sure hope so!
I managed to do this with cx_Oracle.
I used the sys.xmltype.createxml() function in the statement that inserts the rows in a table with XMLTYPE fields; then I used prepare() and setinputsizes() to specify that the bind variables I used for XMLTYPE fields were of cx_Oracle.CLOB type.
I managed to get this to work by wrapping the XMLElement call in a call to XMLType.GetClobVal():
For example:
select xmltype.getclobval(xmlelement("rowcount", count(1))) from...
No idea of the limitations yet but it got me out of trouble. Found the relelvant info on Oracle site
Mastering Oracle+Python, Part 1: Querying Best Practices http://www.oracle.com/technology/pub/articles/prez-python-queries.html