[gdal-dev] Export multiple tables from GPKG to PG
Even Rouault
even.rouault at spatialys.com
Wed Dec 23 08:51:53 PST 2020
On mercredi 23 décembre 2020 16:00:28 CET matteo wrote:
> Hi all (again, sorry for the flooding),
>
> for some reasons I have to export many tables (not all) from a GPKG to a
> PG database.
>
> I can do it easily with a loop, but I need ogr2ogr to do it in a single
> transaction. That's because even if the first N tables are correctly
> imported, at the first error I need a total rollback without importing
> anything in PG.
>
> The "problem" is that I have to specify some parameter in ogr2ogr (e.g.
> -nln) for each table to import.
You could possibly do that in 2 steps:
- use ogr2vrt to create a VRT from your source GeoPackage and rename layers as
you wish
https://github.com/OSGeo/gdal/blob/master/gdal/swig/python/samples/ogr2vrt.py
- and then use ogr2ogr to convert that VRT to PG, with -gt unlimited to do
that in a single transaction
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list