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

2010-05-10 Thread Tobias
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 sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



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

2010-05-10 Thread Michael Bayer
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.
 

On May 10, 2010, at 10:39 AM, Tobias wrote:

 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 sqlalch...@googlegroups.com.
 To unsubscribe from this group, send email to 
 sqlalchemy+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://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 sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.