X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/25d854dc5cf2e8f40ef1e6c34540451d45ce66c3..4fa349315b59bae789c77cbf2ffa0021d1231d64:/nominatim/tools/tiger_data.py diff --git a/nominatim/tools/tiger_data.py b/nominatim/tools/tiger_data.py index 4988e33c..70cecae5 100644 --- a/nominatim/tools/tiger_data.py +++ b/nominatim/tools/tiger_data.py @@ -23,6 +23,7 @@ from nominatim.db.sql_preprocessor import SQLPreprocessor from nominatim.errors import UsageError from nominatim.data.place_info import PlaceInfo from nominatim.tokenizer.base import AbstractAnalyzer, AbstractTokenizer +from nominatim.tools import freeze LOG = logging.getLogger() @@ -108,14 +109,21 @@ def handle_threaded_sql_statements(pool: WorkerPool, fd: TextIO, def add_tiger_data(data_dir: str, config: Configuration, threads: int, - tokenizer: AbstractTokenizer) -> None: + tokenizer: AbstractTokenizer) -> int: """ Import tiger data from directory or tar file `data dir`. """ dsn = config.get_libpq_dsn() + with connect(dsn) as conn: + is_frozen = freeze.is_frozen(conn) + conn.close() + + if is_frozen: + raise UsageError("Tiger cannot be imported when database frozen (Github issue #3048)") + with TigerInput(data_dir) as tar: if not tar: - return + return 1 with connect(dsn) as conn: sql = SQLPreprocessor(conn, config) @@ -137,3 +145,5 @@ def add_tiger_data(data_dir: str, config: Configuration, threads: int, with connect(dsn) as conn: sql = SQLPreprocessor(conn, config) sql.run_sql_file(conn, 'tiger_import_finish.sql') + + return 0