1 files changed, 2 insertions, 5 deletions
diff --git a/synapse/storage/engines/__init__.py b/synapse/storage/engines/__init__.py
index 396143c66c..41d3ccd25b 100644
--- a/synapse/storage/engines/__init__.py
+++ b/synapse/storage/engines/__init__.py
@@ -17,21 +17,18 @@ import platform
from ._base import BaseDatabaseEngine, IncorrectDatabaseSetup
MYPY = False
-if MYPY:
- from .sqlite import Sqlite3Engine
- from .postgres import PostgresEngine
def create_engine(database_config) -> BaseDatabaseEngine:
name = database_config["name"]
- if name == "sqlite3":
+ if name == "sqlite3" or MYPY:
import sqlite3
from .sqlite import Sqlite3Engine
return Sqlite3Engine(sqlite3, database_config)
- if name == "psycopg2":
+ if name == "psycopg2" or MYPY:
# pypy requires psycopg2cffi rather than psycopg2
if platform.python_implementation() == "PyPy":
import psycopg2cffi as psycopg2 # type: ignore
|