]> git.openstreetmap.org Git - nominatim.git/commitdiff
Added --no-superuser flag
authorRobbe Haesendonck <googleit@inuits.eu>
Tue, 19 Sep 2023 14:19:11 +0000 (16:19 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 7 Dec 2023 08:04:33 +0000 (09:04 +0100)
To allow import into already existing databases.
Refs: #2719

nominatim/clicmd/args.py
nominatim/clicmd/setup.py

index eb3a3b6145f3c76dc569ebbcdbd6cbbc4fa48b37..7389bd03a81ccc56dc46b6dcf0db9e17d89148da 100644 (file)
@@ -87,6 +87,7 @@ class NominatimArgs:
     offline: bool
     ignore_errors: bool
     index_noanalyse: bool
     offline: bool
     ignore_errors: bool
     index_noanalyse: bool
+    no_superuser: bool
 
     # Arguments to 'index'
     boundaries_only: bool
 
     # Arguments to 'index'
     boundaries_only: bool
index 8464e151f4f1534034c442446a44bc7c27bce22c..6c262b620f79cb9e54258191558931697913b600 100644 (file)
@@ -65,6 +65,8 @@ class SetupAll:
                            help='Continue import even when errors in SQL are present')
         group3.add_argument('--index-noanalyse', action='store_true',
                            help='Do not perform analyse operations during index (expert only)')
                            help='Continue import even when errors in SQL are present')
         group3.add_argument('--index-noanalyse', action='store_true',
                            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,9 +83,10 @@ class SetupAll:
             if not files:
                 raise UsageError("No input files (use --osm-file).")
 
             if not files:
                 raise UsageError("No input files (use --osm-file).")
 
-            LOG.warning('Creating database')
-            database_import.setup_database_skeleton(args.config.get_libpq_dsn(),
-                                                    rouser=args.config.DATABASE_WEBUSER)
+            if not args.no_superuser:
+                LOG.warning('Creating database')
+                database_import.setup_database_skeleton(args.config.get_libpq_dsn(),
+                                                        rouser=args.config.DATABASE_WEBUSER)
 
             LOG.warning('Setting up country tables')
             country_info.setup_country_tables(args.config.get_libpq_dsn(),
 
             LOG.warning('Setting up country tables')
             country_info.setup_country_tables(args.config.get_libpq_dsn(),