Problem with inserting row containing a value with type PATH of postgres with geoalchemy2

130 views
Skip to first unread message

Christos Ch

unread,
Mar 17, 2020, 11:49:06 AM3/17/20
to sqlalchemy
I have a postgres table below with a field `coordinates` of type path:

 
   CREATE TABLE geometry
       
(
            id serial
not null primary key,
            coordinates path
not null
       
)




Trying to add a Geometry into the table:

    session.add(Geometry(id = 1, coordinates = "path('(15.234428926980286, 47.95865145177352)')"))

 I am getting this error:

 sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedFunction) function st_geomfromewkt(unknown) does not exist

Jonathan Vanasco

unread,
Mar 17, 2020, 12:04:04 PM3/17/20
to sqlalchemy
`st_geomfromewkt` is a function in the PostGIS extension to PostgreSQL.  

Are you certain postgis is installed in the server and enabled for the database?

Christos Ch

unread,
Mar 17, 2020, 12:06:36 PM3/17/20
to sqlalchemy
I am running a service from a docker container

Jonathan Vanasco

unread,
Mar 17, 2020, 1:41:58 PM3/17/20
to sqlalchemy

On Tuesday, March 17, 2020 at 12:06:36 PM UTC-4, Christos Ch wrote:
I am running a service from a docker container

The error is from psycopg2 and stating the function is not available on the PostgreSQL server.  This is most likely because PostGIS is not installed on the server (which could be in the docker container, or elsewhere) or needs to be enabled for that database.

Christos Ch

unread,
Mar 18, 2020, 3:21:06 AM3/18/20
to sqlalchemy
Yes you are right thank you!

Jonathan Vanasco

unread,
Mar 18, 2020, 12:16:28 PM3/18/20
to sqlalchemy
I'm glad it's up and running for you!
Reply all
Reply to author
Forward
0 new messages