From c2172aa56228a2b67e0810f86fb027bb371ac002 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 14 Feb 2019 00:51:58 +0200 Subject: [PATCH] Set alchemysession core mode on by default Bump minimum telethon-session-sqlalchemy version for core mode support on non-postgres engines Fixes #263 --- example-config.yaml | 3 --- mautrix_telegram/__main__.py | 6 +----- mautrix_telegram/config.py | 1 - setup.py | 2 +- 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/example-config.yaml b/example-config.yaml index d2807b30..9f899bbd 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -27,9 +27,6 @@ appservice: # SQLite: sqlite:///filename.db # Postgres: postgres://username:password@hostname/dbname database: sqlite:///mautrix-telegram.db - # Whether or not to use SQLAlchemy Core for common database actions. Use if the bridge is - # being bottlenecked on ORM commits. Only supported with PostgreSQL. - sqlalchemy_core_mode: false # Public part of web server for out-of-Matrix interaction with the bridge. # Used for things like login if the user wants to make sure the 2FA password isn't stored in diff --git a/mautrix_telegram/__main__.py b/mautrix_telegram/__main__.py index e70f6cfe..303d14e9 100644 --- a/mautrix_telegram/__main__.py +++ b/mautrix_telegram/__main__.py @@ -79,11 +79,7 @@ Base.metadata.bind = db_engine session_container = AlchemySessionContainer(engine=db_engine, session=db_session, table_base=Base, table_prefix="telethon_", manage_tables=False) -if config["appservice.sqlalchemy_core_mode"]: - try: - session_container.core_mode = True - except AttributeError: - log.error("Current version of teleton-session-sqlalchemy does not support core mode") +session_container.core_mode = True loop = asyncio.get_event_loop() # type: asyncio.AbstractEventLoop diff --git a/mautrix_telegram/config.py b/mautrix_telegram/config.py index 2c68abcd..468522f5 100644 --- a/mautrix_telegram/config.py +++ b/mautrix_telegram/config.py @@ -165,7 +165,6 @@ class Config(DictWithRecursion): copy("appservice.max_body_size") copy("appservice.database") - copy("appservice.sqlalchemy_core_mode") copy("appservice.public.enabled") copy("appservice.public.prefix") diff --git a/setup.py b/setup.py index 8807e257..c0125280 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ setuptools.setup( "future-fstrings>=0.4.2", "python-magic>=0.4.15,<0.5", "telethon>=1.5.5,<1.6", - "telethon-session-sqlalchemy>=0.2.6,<0.3", + "telethon-session-sqlalchemy>=0.2.7,<0.3", ], extras_require=extras,