1 # SPDX-License-Identifier: GPL-3.0-or-later
3 # This file is part of Nominatim. (https://nominatim.org)
5 # Copyright (C) 2023 by the Nominatim developer community.
6 # For a full list of authors see the git log.
8 Exporting a Nominatim database to SQlite.
10 from typing import Set
11 from pathlib import Path
13 import sqlalchemy as sa
15 import nominatim.api as napi
17 async def convert(project_dir: Path, outfile: Path, options: Set[str]) -> None:
18 """ Export an existing database to sqlite. The resulting database
19 will be usable against the Python frontend of Nominatim.
21 api = napi.NominatimAPIAsync(project_dir)
24 outapi = napi.NominatimAPIAsync(project_dir,
25 {'NOMINATIM_DATABASE_DSN': f"sqlite:dbname={outfile}"})
27 async with api.begin() as inconn, outapi.begin() as outconn: