Is there some compelling reason you wouldn't just install the PostGIS 
extensions? Assuming there is...

You could use a TEXT column to store WKT values or a BLOB/bytea column to 
store WKB representations, and perhaps use hybrid_attributes 
<http://docs.sqlalchemy.org/en/rel_1_0/orm/extensions/hybrid.html> to 
manage the conversion, but realize that because (without PostGIS) the DB 
doesn't semantically understand these types, so you won't be able to filter 
against them (other than IS [NOT] NULL) or use them in any meaningful SQL 
expressions. You'll likely be limited to CRUD capabilities. 

Actually, now that I think about it, since you won't be able to use them in 
query expressions anyway, there's probably no reason to go to the extra 
effort of hybrid properties; just make a pure python property to do the 
conversion between the mapped TEXT|BLOB column and the Geometry types.

But again, trying to use geo types in PostgreSQL without PostGIS just kinda 
sounds like self-flagellation. :)

Ian
 


On Friday, September 4, 2015 at 6:59:29 PM UTC-4, Demitri Muna wrote:
>
> Hi,
>
> Is there a way to use the native PostgreSQL (i.e. not postgis) "polygon" 
> data type through SQLAlchemy? I'm guessing one might be able to define the 
> model class via autoload as normal, then add some kind of custom column 
> definition? Surely someone has done this before, but I haven't been able to 
> find an example.
>
> I've taken a look at geoalchemy and tried to implement that, but was 
> getting this error:
>
> ProgrammingError: (psycopg2.ProgrammingError) function 
> st_asbinary(polygon) does not exist
> LINE 1: ....sdss_frame.filename AS muna_sdss_frame_filename, ST_AsBinar...
>                                                              ^
> HINT:  No function matches the given name and argument types. You might 
> need to add explicit type casts.
>
> If at all possible, I'd prefer to use the native data type, even if it 
> requires a custom adaptor. (Again, surely someone has written this?)
>
> Cheers,
> Demitri
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to