On Jun 9, 2011, at 3:57 AM, Eric Lemoine wrote:

> Hi
> 
> Here's another issue with porting GeoAlchemy to SQLAlchemy 0.7.
> 
> 
> So GeoA defines a TypeEngine, which looks like this:
> 
> class Geometry(TypeEngine):
> 
>    def __init__(self, dimension=2, srid=4326, spatial_index=True, **kwargs):
>        self.dimension = dimension
>        self.srid = srid
>        self.spatial_index = True
>        self.kwargs = kwargs
>        super(GeometryBase, self).__init__()
> 
> 
> Using the Geometry type with Oracle requires passing an additional
> argument to the constructor, namely "diminfo":
> 
>    Geometry(dimension=2, srid=4326, spatial_index=True,
> diminfo='the_diminfo_string')
> 
> Then our Oracle-specific code uses type.kwargs['diminfo'] to access
> the "diminfo" value.
> 
> 
> This worked well with SQLA 0.6, but it doesn't work with SQLA 0.7.
> 
> It doesn't work with 0.7 because SQLA may clone the type instance, and
> because of the way SQLA clones object (constructor_copy), the clone
> does not have self.kwargs['diminfo'].

That's the default adaption provided by TypeEngine.adapt().    Provide your own 
adapt() that does what's needed.  For examples see Interval, Enum.

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

Reply via email to