@celery.task()
def my_task():
    session = db.create_scoped_session()
session.add(User(id=13, value='random string'))
session.commit()
return
Connection is closed when a SQLAlchemy event triggers a Celery task