Skip to content

Commit

Permalink
Set alchemysession core mode on by default
Browse files Browse the repository at this point in the history
Bump minimum telethon-session-sqlalchemy version for core mode support on non-postgres engines
Fixes #263
  • Loading branch information
tulir committed Feb 13, 2019
1 parent 9174186 commit c2172aa
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 10 deletions.
3 changes: 0 additions & 3 deletions example-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions mautrix_telegram/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,7 @@
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

Expand Down
1 change: 0 additions & 1 deletion mautrix_telegram/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ def copy_dict(from_path, to_path=None, override_existing_map=True) -> None:
copy("appservice.max_body_size")

copy("appservice.database")
copy("appservice.sqlalchemy_core_mode")

copy("appservice.public.enabled")
copy("appservice.public.prefix")
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"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,

Expand Down

0 comments on commit c2172aa

Please sign in to comment.