Is there a way to define GID column as sequential (auto-incremental) when loading GeoDataFrame (created from Shapefile) to PostGIS? I use Geopandas and "to_sql" method:

geodataframe.to_sql(tablename, engine, if_exists='fail', index=False, dtype={'gid':INTEGER(), 'user_name':Text, 'sessions':Text, 'geom':Geometry('MULTILINESTRING', srid=4326)})

I could not find any valid SQLAlchemy data type. It seems that none exists. Other option I see is: do not load GID column but create it after uploading data to PostGIS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.