RyanSiu1995 commented on issue #8780: URL: https://github.com/apache/airflow/issues/8780#issuecomment-625756560
@msumit Thank you for your reply. I am thinking a change like this. We reinitiate the database session dynamically in this util files. https://github.com/apache/airflow/blob/1.10.10/airflow/utils/db.py#L38-L50 The code will be like this. ``` def create_session(): """ Contextmanager that will create and teardown a session. """ have_session = True if settings.Session == None: settings.configure_orm(disable_connection_pool=True) session = settings.Session() try: yield session session.commit() except Exception: session.rollback() raise finally: session.close() if not have_session: settings.dispose_orm() ``` This actually resolves in my case. But not pretty sure if it is proper to initiate a dynamic session with the `create_session()` function. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
