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 2021/11/24 06:51:49 UTC

[GitHub] [airflow] yuqian90 commented on pull request #18453: Remove redundant ``session.commit()`` in migration

yuqian90 commented on pull request #18453:
URL: https://github.com/apache/airflow/pull/18453#issuecomment-977582452


   Hi @kaxil , in some of the tests we run, we populate an empty sqlite meta data db by doing `airflow db init`. However, since this revision, we a encountering the following error when running `airflow db init`:
   
   ```
       lib/python3.8/site-packages/alembic/runtime/migration.py", line 542, in run_migrations
           raise util.CommandError(
       alembic.util.exc.CommandError: Migration "upgrade 127d2bf2dfa7 -> cc1e65623dc7, add max tries column to task instance" has left an uncommitted transaction opened; transactional_ddl is False so Alembic is not committing transactions
   ```
   
   This is happening because the test meta data db is empty. So the if condition here is True and the code just returns without committing the transaction.
   
   ```
           if not bool(session.query(TaskInstance).first()):
               return
   ```
   
   Does anyone have any suggestions how to get around this error?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org