On Sep 12, 2010, at 6:23 AM, millsks wrote:

> I was curious if there were any way to pull a XMLType field into a
> python field when using declarative.  I have been able to do it with
> cx_Oracle by executing a query using XMLType.getClobVal and would
> probably work with sqlalchemy's manual query system too, but would
> love it if I could use it as part of an ORM object as an actual column/
> field or as a relationship.
> 
> If this is possible where should I look to learn how to integrate it
> into our sqlalchemy code?


first you'd have to tell me what XMLType.getClobVal is, as cx_oracle's 
documentation does not mention it in their index:

http://cx-oracle.sourceforge.net/html/genindex.html

next, you would make sure you can make it work within a SQLAlchemy Table 
object, probably using a plain sqlalchemy.types.CLOB object if that's the kind 
of type cx_oracle treats it as - when used with cx_oracle, the ultimate type 
would call upon _LOBMixin in order to provide the read() method that cx_oracle 
asks of those types.

Failing that, you'd subclass UserDefinedType and make a type that does what 
cx_oracle wants to read/write a Python value.

The ORM part then comes for free as it rides on top of Table metadata.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to