From 0ced46058a20f27fbee4acbfbd8360175cefff3e Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 8 Jun 2020 00:27:41 +0200 Subject: [PATCH] Always set check_same_thread=False in case of SQLite engines. Platypush is heavily multi-threaded, and it can happen that some transactions are handled in different threads - and consistency is managed by the application itself. --- platypush/plugins/db/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platypush/plugins/db/__init__.py b/platypush/plugins/db/__init__.py index 9e804578..0e99dd5b 100644 --- a/platypush/plugins/db/__init__.py +++ b/platypush/plugins/db/__init__.py @@ -39,6 +39,8 @@ class DbPlugin(Plugin): if engine: if isinstance(engine, Engine): return engine + if engine.startswith('sqlite://'): + kwargs['connect_args'] = {'check_same_thread': False} return create_engine(engine, *args, **kwargs)