Hello list,


I can't find an example for a user defined type that has to produce custom SQL. What I want is to implement a PostGIS geometry column and it basically has to do two things:


1. Implement own SQL for insert/update, to produce for example:

INSERT INTO .... (..., xyzzy, ....) VALUES (..., transform(PointFromText( %s ), 4269), 32661) , ....) ....

UPDATE .... SET xyzzy=transform(PointFromText( %s ), 4269), 32661) ...


2. Internally carry a tuple X that will be bound as string "POINT({0} {1})".format(x[0], x[1])

3. Parse PostgreSQL array result back into tuple X



I've managed to produce #2 and #3 with a UserDefinedType, but I don't know how to tell it to produce custom SQL, aside to bind_processor, for #1. I'm also using get_col_spec for the UserDefinedType for DDL.


BTW, GeoAlchemy is beside the point here. I want to learn how to produce custom types like this.


Thanks,

--


.oO V Oo.


Work Hard,
Increase Production,
Prevent Accidents,
and
Be Happy!  ;)

--
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