mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-22 20:50:23 +03:00
Don't import Sqlite3Engine unless running synapse with sqlite3
This commit is contained in:
parent
8895c38202
commit
f5fd9b98c7
1 changed files with 3 additions and 2 deletions
|
@ -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,))
|
||||
|
|
Loading…
Reference in a new issue