]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/clicmd/transition.py
save software version in the database
[nominatim.git] / nominatim / clicmd / transition.py
index de4e16cac2e05bda4f1b2c06f4d58787b4d90dae..210eec70a2ce656995f3258f20b3e68837ffd609 100644 (file)
@@ -48,6 +48,8 @@ class AdminTransition:
                            help='Size of cache to be used by osm2pgsql (in MB)')
         group.add_argument('--no-analyse', action='store_true',
                            help='Do not perform analyse operations during index')
                            help='Size of cache to be used by osm2pgsql (in MB)')
         group.add_argument('--no-analyse', action='store_true',
                            help='Do not perform analyse operations during index')
+        group.add_argument('--ignore-errors', action='store_true',
+                           help="Ignore certain erros on import.")
 
     @staticmethod
     def run(args):
 
     @staticmethod
     def run(args):
@@ -59,12 +61,12 @@ class AdminTransition:
 
         if args.setup_db:
             LOG.warning('Setup DB')
 
         if args.setup_db:
             LOG.warning('Setup DB')
-            mpath = database_import.install_module(args.module_dir, args.project_dir,
-                                                   args.config.DATABASE_MODULE_PATH)
 
             with connect(args.config.get_libpq_dsn()) as conn:
                 database_import.setup_extensions(conn)
 
             with connect(args.config.get_libpq_dsn()) as conn:
                 database_import.setup_extensions(conn)
-                database_import.check_module_dir_path(conn, mpath)
+                database_import.install_module(args.module_dir, args.project_dir,
+                                               args.config.DATABASE_MODULE_PATH,
+                                               conn=conn)
 
             database_import.import_base_data(args.config.get_libpq_dsn(),
                                              args.data_dir, args.no_partitions)
 
             database_import.import_base_data(args.config.get_libpq_dsn(),
                                              args.data_dir, args.no_partitions)
@@ -75,7 +77,8 @@ class AdminTransition:
                 raise UsageError('Missing required --osm-file argument')
             database_import.import_osm_data(Path(args.osm_file),
                                             args.osm2pgsql_options(0, 1),
                 raise UsageError('Missing required --osm-file argument')
             database_import.import_osm_data(Path(args.osm_file),
                                             args.osm2pgsql_options(0, 1),
-                                            drop=args.drop)
+                                            drop=args.drop,
+                                            ignore_errors=args.ignore_errors)
 
         if args.load_data:
             LOG.warning('Load data')
 
         if args.load_data:
             LOG.warning('Load data')
@@ -88,7 +91,7 @@ class AdminTransition:
             with connect(args.config.get_libpq_dsn()) as conn:
                 try:
                     status.set_status(conn, status.compute_database_date(conn))
             with connect(args.config.get_libpq_dsn()) as conn:
                 try:
                     status.set_status(conn, status.compute_database_date(conn))
-                except Exception as exc: # pylint: disable=bare-except
+                except Exception as exc: # pylint: disable=broad-except
                     LOG.error('Cannot determine date of database: %s', exc)
 
         if args.index:
                     LOG.error('Cannot determine date of database: %s', exc)
 
         if args.index: