Last update: 2020-03-17
Flask-SQLAlchemy has some nice built-ins (e.g. accessing
query directly on classes). To continue leveraging these nicities while still inside of a Celery worker, we need to make sure we setup/teardown in a similar fashion to Flask-SQLAlchemy does on Flask.
create_scoped_session at startup which avoids any setup on a per-request basis.
This means Celery can piggyback off of this initialization.