[gdal-dev] PG driver: apply custom sql files together with loading data in one transaction

Even Rouault even.rouault at spatialys.com
Thu Aug 30 07:28:37 PDT 2018


On jeudi 30 août 2018 11:44:10 CEST Martin Landa wrote:
> Hi,
> 
> I have a Python application which loads data into PostGIS DB using
> GDAL Python API. Input files are processed in one transaction (done on
> datasource level). After loading data there some custom SQL files
> applied (currently implemented using psycopg2). There is a request to
> perform loading data and customization SQL files in one transaction.
> Is there any option how to apply SQL custom files on data source level
> using GDAL API?

With unmodified GDALVectorTranslate() it isn't really possible. So you don't 
have much options than using StartTransaction(), using the OGR CreateFeature() 
API by yourself to do ogr2ogr-like ingestion, and then ExecuteSQL() for your 
customizations.

It could be desirable to have a way to instruct GDALVectorTranslate() not to 
mess at all with transactions. Like a "-gt none" syntax. There shouldn't be 
much change to implement that.

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list