Hi, Based on some posts I was able to find scouring Google, I was trying to implement a custom type (GeometryType) for the PostGIS "GEOMETRY" column.
Now, I should point out that I am not using sqlalchemy to build the DDL, since the geometry columns are indirectly created by invoking stored procedures (and I couldn't really figure out a clean way to handle that). I am, however, using these Geometry types in my Table instances [mapping to already-created tables]. The problem is that I'd like to have sqlalchemy return KML for all geometry types by default, but I don't know how to setup my type to specify a SQL function that needs to be applied to the column in the select clause. Is this possible? Alternatively, it would be *perfect* to have additional *_kml properties added to the result objects (one for each GEOMETRY column), but this seems even more complex (?). Here is my simple type class: class GeometryType(sa.types.TypeEngine): def __init__(self, SRID, typeName, dimension): super(GeometryType, self).__init__() self.mSrid = SRID self.mType = typeName.upper() self.mDim = dimension def __repr__(self): return "%s:%s-%s(%s)" % (self.__class__.__name__, self.mType, self.mDim, self.mSrid) def get_col_spec(self): return "GEOMETRY" def convert_bind_param(self, value, engine): if not value: return None else: return 'GeomFromText(\'%s\',%s)' % (value, self.mSrid) def convert_result_value(self, value, engine): return 'AsKml(%s)' % value I was expecting my convert_result_value method to operate on the SQL, but I am assuming from looking at the generated SQL that this method is actually going to operate on the raw data that was returned from SQL. So, is there a way to accomplish what I want? Thanks in advance! Hans --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---