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 ..db.connection import connect
 
  13 from .args import NominatimArgs
 
  18     Make database read-only.
 
  20     About half of data in the Nominatim database is kept only to be able to
 
  21     keep the data up-to-date with new changes made in OpenStreetMap. This
 
  22     command drops all this data and only keeps the part needed for geocoding
 
  25     This command has the same effect as the `--no-updates` option for imports.
 
  28     def add_args(self, parser: argparse.ArgumentParser) -> None:
 
  31     def run(self, args: NominatimArgs) -> int:
 
  32         from ..tools import freeze
 
  34         with connect(args.config.get_libpq_dsn()) as conn:
 
  35             freeze.drop_update_tables(conn)
 
  36         freeze.drop_flatnode_file(args.config.get_path('FLATNODE_FILE'))