- --upsert
Added in version 3.12.
Variant of
--appendwhere theOGRLayer::UpsertFeature()operation is used to insert or update features instead of appending withOGRLayer::CreateFeature().This is currently implemented only in a few drivers: GPKG -- GeoPackage vector, Elasticsearch: Geographically Encoded Objects for Elasticsearch and MongoDBv3 (drivers that implement upsert expose the
GDAL_DCAP_UPSERTcapability).The upsert operation uses the FID of the input feature, when it is set (and the FID column name is not the empty string), as the key to update existing features. It is crucial to make sure that the FID in the source and target layers are consistent.
For the GPKG driver, it is also possible to upsert features whose FID is unset or non-significant (the
--unset-fidoption of gdal vector edit can be used to ignore the FID from the source feature), when there is a UNIQUE column that is not the integer primary key.