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.
This commit is contained in:
Fabio Manganiello 2020-06-08 00:27:41 +02:00
parent 6ba92e7fdd
commit 0ced46058a
1 changed files with 2 additions and 0 deletions

View File

@ -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)