mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
change updates to handle delete/insert workflow
This makes Nominatim compatible with osm2pgsql's default update modus operandi of deleting and reinserting data. Deletes are diverted into a TODO table instead of executing them. When data is reinserted, the corresponding entry in the TODO table is deleted. After updates are finished, the remaining entries in the TODO table are executed, doing the same work as the delete trigger did before. The new behaviour also works against the gazetteer output with its insert-only mechanism.
This commit is contained in:
@@ -10,6 +10,7 @@ import os
|
||||
from pathlib import Path
|
||||
|
||||
from nominatim.tools.exec_utils import run_osm2pgsql
|
||||
from nominatim.tools.replication import run_osm2pgsql_updates
|
||||
|
||||
from geometry_alias import ALIASES
|
||||
|
||||
@@ -118,6 +119,7 @@ def update_from_osm_file(context):
|
||||
# create an OSM file and import it
|
||||
fname = write_opl_file(context.text, context.osm)
|
||||
try:
|
||||
run_osm2pgsql(get_osm2pgsql_options(context.nominatim, fname, append=True))
|
||||
run_osm2pgsql_updates(context.db,
|
||||
get_osm2pgsql_options(context.nominatim, fname, append=True))
|
||||
finally:
|
||||
os.remove(fname)
|
||||
|
||||
Reference in New Issue
Block a user