mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-11 21:34:06 +00:00
Merge pull request #3463 from lonvia/sqlalchemy14-with-psycopg
Make sure SQLAlchemy can handle the loaded dialect
This commit is contained in:
@@ -7,15 +7,17 @@
|
|||||||
"""
|
"""
|
||||||
Import the base library to use with asynchronous SQLAlchemy.
|
Import the base library to use with asynchronous SQLAlchemy.
|
||||||
"""
|
"""
|
||||||
# pylint: disable=invalid-name
|
# pylint: disable=invalid-name, ungrouped-imports, unused-import
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
import sqlalchemy.dialects.postgresql.psycopg
|
||||||
import psycopg
|
import psycopg
|
||||||
PGCORE_LIB = 'psycopg'
|
PGCORE_LIB = 'psycopg'
|
||||||
PGCORE_ERROR: Any = psycopg.Error
|
PGCORE_ERROR: Any = psycopg.Error
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
|
import sqlalchemy.dialects.postgresql.asyncpg
|
||||||
import asyncpg
|
import asyncpg
|
||||||
PGCORE_LIB = 'asyncpg'
|
PGCORE_LIB = 'asyncpg'
|
||||||
PGCORE_ERROR = asyncpg.PostgresError
|
PGCORE_ERROR = asyncpg.PostgresError
|
||||||
|
|||||||
Reference in New Issue
Block a user