You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2018/12/28 04:42:56 UTC

[GitHub] stale[bot] closed pull request #2632: [AIRFLOW-1642] Use scoped_session in alembic revision cc1e65623dc7

stale[bot] closed pull request #2632: [AIRFLOW-1642] Use scoped_session in alembic revision cc1e65623dc7
URL: https://github.com/apache/incubator-airflow/pull/2632
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/migrations/versions/cc1e65623dc7_add_max_tries_column_to_task_instance.py b/airflow/migrations/versions/cc1e65623dc7_add_max_tries_column_to_task_instance.py
index b151e0cf4c..f157617a35 100644
--- a/airflow/migrations/versions/cc1e65623dc7_add_max_tries_column_to_task_instance.py
+++ b/airflow/migrations/versions/cc1e65623dc7_add_max_tries_column_to_task_instance.py
@@ -46,8 +46,7 @@ def upgrade():
 
     if 'task_instance' in tables:
         # Get current session
-        sessionmaker = sa.orm.sessionmaker()
-        session = sessionmaker(bind=connection)
+        session = settings.Session()
         dagbag = DagBag(settings.DAGS_FOLDER)
         query = session.query(sa.func.count(TaskInstance.max_tries)).filter(
             TaskInstance.max_tries == -1
@@ -79,9 +78,7 @@ def upgrade():
 def downgrade():
     engine = settings.engine
     if engine.dialect.has_table(engine, 'task_instance'):
-        connection = op.get_bind()
-        sessionmaker = sa.orm.sessionmaker()
-        session = sessionmaker(bind=connection)
+        session = settings.Session()
         dagbag = DagBag(settings.DAGS_FOLDER)
         query = session.query(sa.func.count(TaskInstance.max_tries)).filter(
             TaskInstance.max_tries != -1


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services