Hi,

I am using SQLAlchemy 0.6 together with cx_Oracle and I am receiving
an error message when a database function is inside a package and has
to be called like "package.functionname".

For example the following query can reproduce the error (beside that
this query makes not much sense):

  >>> session.query(table('spots',
column('spot_location'))).filter(getattr(func, 'MDSYS.SDO_GEOMETRY')
('POINT(0 0)', 4326) == text('spot_location')).first()

The output is:

2010-05-06 10:29:45,530 INFO sqlalchemy.engine.base.Engine.0x...a8ac
SELECT spots_spot_location
FROM (SELECT spots_spot_location, ROWNUM AS ora_rn
FROM (SELECT spots.spot_location AS spots_spot_location
FROM spots
WHERE
MDSYS.SDO_GEOMETRY(:"MDSYS.SDO_GEOMETRY_1", :"MDSYS.SDO_GEOMETRY_2") =
spot_location)
WHERE ROWNUM <= :ROWNUM_1)
WHERE ora_rn > :ora_rn_1
2010-05-06 10:29:45,530 INFO sqlalchemy.engine.base.Engine.0x...a8ac
{'ora_rn_1': 0, 'ROWNUM_1': 1, u'"MDSYS.SDO_GEOMETRY_2"': 4326,
u'"MDSYS.SDO_GEOMETRY_1"': 'POINT(0 0)'}
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>

[..]

  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.DatabaseError: (DatabaseError) ORA-01036: illegal
variable name/number
 'SELECT spots_spot_location \nFROM (SELECT spots_spot_location,
ROWNUM AS ora_rn \nFROM (SELECT spots.spot_location AS
spots_spot_location \nFROM spots \nWHERE
MDSYS.SDO_GEOMETRY(:"MDSYS.SDO_GEOMETRY_1", :"MDSYS.SDO_GEOMETRY_2") =
spot_location) \nWHERE ROWNUM <= :ROWNUM_1) \nWHERE ora_rn
> :ora_rn_1' {'ora_rn_1': 0, 'ROWNUM_1': 1, u'"MDSYS.SDO_GEOMETRY_2"':
4326, u'"MDSYS.SDO_GEOMETRY_1"': 'POINT(0 0)'}

Something is wrong about the escaping.

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.

Reply via email to