diff --git a/synapse/storage/engines/__init__.py b/synapse/storage/engines/__init__.py index 035f9ea6e9..b3ab98c0fc 100644 --- a/synapse/storage/engines/__init__.py +++ b/synapse/storage/engines/__init__.py @@ -15,8 +15,6 @@ import platform from ._base import BaseDatabaseEngine, IncorrectDatabaseSetup -from .postgres import PostgresEngine -from .sqlite import Sqlite3Engine def create_engine(database_config) -> BaseDatabaseEngine: @@ -24,6 +22,7 @@ def create_engine(database_config) -> BaseDatabaseEngine: if name == "sqlite3": import sqlite3 + from .sqlite import Sqlite3Engine return Sqlite3Engine(sqlite3, database_config) @@ -34,6 +33,8 @@ def create_engine(database_config) -> BaseDatabaseEngine: else: import psycopg2 # type: ignore + from .postgres import PostgresEngine + return PostgresEngine(psycopg2, database_config) raise RuntimeError("Unsupported database engine '%s'" % (name,))