Commits

Anonymous committed 0a8eb81

column expression did not contain table name

Comments (0)

Files changed (2)

geoalchemy/geometry.py

 @compiles(GeometryExtensionColumn)
 def compile_column(element, compiler, **kw):
     if kw.has_key("within_columns_clause") and kw["within_columns_clause"] == True:
-        return "AsBinary(%s)" % element.name
+        return "AsBinary(%s)" % element
         
     return element.name
      

geoalchemy/tests/test_spatialite.py

         road_null = Road(road_name='Jeff Rd', road_geom=None)
         session.add(road_null)
         session.commit();
+        
+    def test_query_column_name(self):
+        # test for bug: http://groups.google.com/group/geoalchemy/browse_thread/thread/6b731dd1673784f9
+        from sqlalchemy.orm.query import Query
+        query = Query(Road.road_geom).__str__()
+        ok_('AsBinary(roads.road_geom)' in query, 'table name is part of the column expression')