You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2020/06/15 17:20:24 UTC

[airflow] 03/03: [AIRFLOW-3973] Commit after each alembic migration (#4797)

This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch v1-10-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 8f552cc09a54989f6212c735d2afca1a76431576
Author: Elliott Shugerman <es...@medianewsgroup.com>
AuthorDate: Tue Jun 9 14:12:47 2020 -0600

    [AIRFLOW-3973] Commit after each alembic migration (#4797)
    
    If `Variable`s are used in DAGs, and Postgres is used for the internal
    database, a fresh `$ airflow initdb` (or `$ airflow resetdb`) spams the
    logs with error messages (but does not fail).
    
    This commit corrects this by running each migration in a separate
    transaction.
    
    Co-authored-by: Elliott Shugerman <ee...@medianewsgroup.com>
    
    (cherry picked from commit ea95e9c7236969acc807c65de0f12633d04753a0)
---
 airflow/migrations/env.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/airflow/migrations/env.py b/airflow/migrations/env.py
index 2de0c2f..234c795 100644
--- a/airflow/migrations/env.py
+++ b/airflow/migrations/env.py
@@ -81,6 +81,7 @@ def run_migrations_online():
     with connectable.connect() as connection:
         context.configure(
             connection=connection,
+            transaction_per_migration=True,
             target_metadata=target_metadata,
             compare_type=COMPARE_TYPE,
             render_as_batch=True