Hi, I am currently working on adding support for Oracle to GeoAlchemy and Oracle has some methods [1] that (somehow) are only recognized when a table alias is used. The function "aliased" [2] seemed to work perfectly, but then I realized that the compiler extension for my custom column is not executed anymore.
The compiler extension looks like this [3]: [..] class GeometryExtensionColumn(Column): pass @compiles(GeometryExtensionColumn) def compile_column(element, compiler, **kw): if kw.has_key("within_columns_clause") and kw["within_columns_clause"] == True: return compiler.process(functions.wkb(element)) return element.__str__() [..] And if I make a query using the original mapped class, it works as expected: s = session.query(Spot).get(1) 2010-05-10 11:49:19,957 INFO sqlalchemy.engine.base.Engine.0x...408c SELECT SDO_UTIL.TO_WKBGEOMETRY(spots.spot_location) AS spots_spot_location, spots.spot_id AS spots_spot_id, spots.spot_height AS spots_spot_height FROM spots WHERE spots.spot_id = :param_1 2010-05-10 11:49:19,958 INFO sqlalchemy.engine.base.Engine.0x...408c {'param_1': 1} But when I create an alias and use this alias in a query, "compile_column" is not called anymore and in this case "SDO_UTIL.TO_WKBGEOMETRY" is not added to the query: spot_alias = aliased(Spot) s_alias = session.query(spot_alias).filter(spot_alias.spot_id == 1).first() 2010-05-10 11:49:36,481 INFO sqlalchemy.engine.base.Engine.0x...408c SELECT spots_1_spot_location, spots_1_spot_id, spots_1_spot_height FROM (SELECT spots_1_spot_location, spots_1_spot_id, spots_1_spot_height, ROWNUM AS ora_rn FROM (SELECT spots_1.spot_location AS spots_1_spot_location, spots_1.spot_id AS spots_1_spot_id, spots_1.spot_height AS spots_1_spot_height FROM spots spots_1 WHERE spots_1.spot_id = :spot_id_1) WHERE ROWNUM <= :ROWNUM_1) WHERE ora_rn > :ora_rn_1 What is going wrong? Thanks, Tobias [1]: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11830/sdo_objrelschema.htm#insertedID3 [2]: http://www.sqlalchemy.org/docs/ormtutorial.html#using-aliases [3]: http://bitbucket.org/geoalchemy/geoalchemy/src/c0bfcd46cb3a/geoalchemy/geometry.py#cl-121 -- 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.