8 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: Spatial data (PostGI...| From | Sent On | Attachments |
|---|---|---|
| Allen | 23 Feb 2007 09:37 | |
| Allen Bierbaum | 25 Feb 2007 09:02 | |
| Michael Bayer | 25 Feb 2007 11:20 | |
| Allen Bierbaum | 25 Feb 2007 13:43 | |
| Allen Bierbaum | 25 Feb 2007 15:03 | |
| Allen Bierbaum | 27 Feb 2007 05:46 | |
| Michael Bayer | 27 Feb 2007 08:41 | |
| Michael Bayer | 27 Feb 2007 09:12 |
| Subject: | [sqlalchemy] Re: Spatial data (PostGIS/OGC) with SqlAlchemy![]() |
|---|---|
| From: | Allen Bierbaum (abie...@gmail.com) |
| Date: | 02/25/2007 03:03:07 PM |
| List: | com.googlegroups.sqlalchemy |
[snip]
When I use this with my table and datamapper code, it looks like everything is working fine but the generated SQL insert statement fails with a exception:
sqlalchemy.exceptions.SQLError: (ProgrammingError) parse error - invalid geometry 'INSERT INTO gis_entity (id, name, pos) VALUES (%(mId)s, %(mName)s, %(mPos)s)' {'mName': 'New entity', 'mId': 1L, 'mPos': "GeomFromText('POINT(100 100)',-1)"}
I know from using sql directly in pgadmin3 that this line works correctly:
insert into gis_entity (id, name, pos) values (2, 'New entity', GeomFromText('POINT(100 100)', -1));
Does anyone see how this varies from the sql statement issued by SA?
By looking at the postgres log I figured out what was causing the error, but I still don't know how to fix it.
The problem is that SA considers "GeomFromText('POINT(100 100)', -1)" to be a string so it puts it in single quotes when creating the SQL command to execute. This causes problems because them postgres doesn't know it could be calling a method instead. I have tried returning an sqlalchemy.func object but this doesn't work either.
Any ideas?
-Allen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqla...@googlegroups.com
To unsubscribe from this group, send email to
sqla...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---




