Added --no-superuser flag

To allow import into already existing databases.
Refs: #2719
This commit is contained in:
Robbe Haesendonck
2023-09-19 16:19:11 +02:00
committed by Sarah Hoffmann
parent 3c32c0354a
commit ba5ec80611
2 changed files with 7 additions and 3 deletions

View File

@@ -87,6 +87,7 @@ class NominatimArgs:
offline: bool offline: bool
ignore_errors: bool ignore_errors: bool
index_noanalyse: bool index_noanalyse: bool
no_superuser: bool
# Arguments to 'index' # Arguments to 'index'
boundaries_only: bool boundaries_only: bool

View File

@@ -65,6 +65,8 @@ class SetupAll:
help='Continue import even when errors in SQL are present') help='Continue import even when errors in SQL are present')
group3.add_argument('--index-noanalyse', action='store_true', group3.add_argument('--index-noanalyse', action='store_true',
help='Do not perform analyse operations during index (expert only)') help='Do not perform analyse operations during index (expert only)')
group3.add_argument('--no-superuser', action='store_true',
help='Do not attempt to create the database')
def run(self, args: NominatimArgs) -> int: # pylint: disable=too-many-statements def run(self, args: NominatimArgs) -> int: # pylint: disable=too-many-statements
@@ -81,6 +83,7 @@ class SetupAll:
if not files: if not files:
raise UsageError("No input files (use --osm-file).") raise UsageError("No input files (use --osm-file).")
if not args.no_superuser:
LOG.warning('Creating database') LOG.warning('Creating database')
database_import.setup_database_skeleton(args.config.get_libpq_dsn(), database_import.setup_database_skeleton(args.config.get_libpq_dsn(),
rouser=args.config.DATABASE_WEBUSER) rouser=args.config.DATABASE_WEBUSER)