Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

SqlAlchemy supports most database specific data types via dialects, but I could not find anything to work with the postgresql xml column type. Does somebody know a working solution. Idealy it should not require a custom column type implementation by myself.

share|improve this question
I don't see it implemented in the postgresql dialects with sqlalchemy 0.8. You could try using reflection to load an existing psql schema with an XML column and seeing how gracefully sqlalchemy handles it. But even in the best case I don't think you'll get nice things like XPATH indexing even if reflection does do something graceful like exposing the column as a text type. Try filing an enhancement request in the sqlalchemy issue tracker. – JosefAssad Apr 22 at 18:50
Do also have a look at zzzeek's example of using adjacency list to store XML data: bitbucket.org/sqlalchemy/sqlalchemy/src/… – JosefAssad Apr 22 at 19:00
we try to rely on psycopg2 as much as possible for these types, while they support JSON and HSTORE they don't have an XML type: initd.org/psycopg/docs/extras.html#additional-data-types. that said you can still get lots of functionality here using the techinques at docs.sqlalchemy.org/en/rel_0_8/core/types.html#types-custom, and we'd certainly accept pull requests for completed code. – zzzeek Apr 23 at 23:28

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.