[sqlalchemy] (NotSupportedError) Variable_TypeByValue(): unhandled data type cx_Oracle.OBJECT

597 views
Skip to first unread message

Tobias

unread,
May 10, 2010, 10:39:18 AM5/10/10
to sqlalchemy
Hi!

Using cx_oracle and SQLAlchemy 0.6 I am having troubles with Oracle
objects (cx_Oracle.OBJECT) as function parameters. For example I have
a function that returns an object of type cx_Oracle.OBJECT, and now I
want to use that object as argument for a new function call:

>>> obj = session.scalar(func.SDO_GEOMETRY('POINT(0 0)', 4326))
2010-05-10 16:23:57,337 INFO sqlalchemy.engine.base.Engine.0x...b82c
SELECT SDO_GEOMETRY(:SDO_GEOMETRY_2, :SDO_GEOMETRY_3) AS
"SDO_GEOMETRY_1" FROM DUAL
2010-05-10 16:23:57,337 INFO sqlalchemy.engine.base.Engine.0x...b82c
{'SDO_GEOMETRY_2': 'POINT(0 0)', 'SDO_GEOMETRY_3': 4326}
>>> session.scalar(func.SDO_UTIL.TO_WKTGEOMETRY(obj))
[..]
File "/../env/lib/python2.6/site-packages/SQLAlchemy-0.6.0-py2.6.egg/
sqlalchemy/engine/default.py", line 277, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.NotSupportedError: (NotSupportedError)
Variable_TypeByValue(): unhandled data type cx_Oracle.OBJECT 'SELECT
SDO_UTIL.TO_WKTGEOMETRY(:TO_WKTGEOMETRY_2) AS "TO_WKTGEOMETRY_1" FROM
DUAL' {'TO_WKTGEOMETRY_2': <cx_Oracle.OBJECT object at 0x8e2f560>}
>>>

I tried to set a type using "bindparam", but that did not help:

>>> session.scalar(func.SDO_UTIL.TO_WKTGEOMETRY(bindparam('', wkt, type_=LargeBinary)))


What can I do?

Thanks,
Tobias

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

Michael Bayer

unread,
May 10, 2010, 11:45:13 AM5/10/10
to sqlal...@googlegroups.com
the first step here would be to create a cx_oracle -only application that issues your query and gets the right result back. then we can make sure sqlalchemy is passing that along in the same way. The error you are seeing is generated by cx_oracle (SQLA just wraps the NotSupportedError). What may be the issue here is that cx_oracle.OBJECT is being used at all - SQLAlchemy is not aware of this type so it appears to be some guess that cx_oracle is making about input or output parameters.

Tobias

unread,
May 12, 2010, 2:21:19 AM5/12/10
to sqlalchemy
Ok, nothing wrong with SQLAlchemy, cx_Oracle does not support Oracle
objects (yet):
http://sourceforge.net/mailarchive/message.php?msg_name=AANLkTilkBwWsIy0yEFQpPOvQiF-k9RxvlYlKf2KyaOfw%40mail.gmail.com
> > For more options, visit this group athttp://groups.google.com/group/sqlalchemy?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
> To post to this group, send email to sqlal...@googlegroups.com.
> To unsubscribe from this group, send email to sqlalchemy+...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/sqlalchemy?hl=en.
Reply all
Reply to author
Forward
0 new messages