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 Import the base library to use with asynchronous SQLAlchemy.
10 from typing import Any
15 import sqlalchemy.dialects.postgresql.psycopg
17 PGCORE_LIB = 'psycopg'
18 PGCORE_ERROR: Any = psycopg.Error
19 except ModuleNotFoundError:
20 import sqlalchemy.dialects.postgresql.asyncpg
22 PGCORE_LIB = 'asyncpg'
23 PGCORE_ERROR = asyncpg.PostgresError