1 # SPDX-License-Identifier: GPL-3.0-or-later
3 # This file is part of Nominatim. (https://nominatim.org)
5 # Copyright (C) 2024 by the Nominatim developer community.
6 # For a full list of authors see the git log.
8 Implementation of the 'freeze' subcommand.
12 from nominatim_core.db.connection import connect
13 from .args import NominatimArgs
15 # Do not repeat documentation of subcommand classes.
16 # pylint: disable=C0111
17 # Using non-top-level imports to avoid eventually unused imports.
18 # pylint: disable=E0012,C0415
22 Make database read-only.
24 About half of data in the Nominatim database is kept only to be able to
25 keep the data up-to-date with new changes made in OpenStreetMap. This
26 command drops all this data and only keeps the part needed for geocoding
29 This command has the same effect as the `--no-updates` option for imports.
32 def add_args(self, parser: argparse.ArgumentParser) -> None:
36 def run(self, args: NominatimArgs) -> int:
37 from ..tools import freeze
39 with connect(args.config.get_libpq_dsn()) as conn:
40 freeze.drop_update_tables(conn)
41 freeze.drop_flatnode_file(args.config.get_path('FLATNODE_FILE'))