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

jedcunningham pushed a commit to branch v2-3-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 7ee739bb9202e9d5318d1513b55676ab75b66e3b
Author: Daniel Standish <[email protected]>
AuthorDate: Wed May 11 07:13:57 2022 -0700

    Simplify flash message for _airflow_moved tables (#23635)
    
    Co-authored-by: Jed Cunningham 
<[email protected]>
    (cherry picked from commit b68667843c7a9796e7017b729f4474c0b0c990cd)
---
 airflow/www/templates/airflow/dags.html | 26 +++++++++++++++++++-------
 airflow/www/views.py                    |  4 ++--
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/airflow/www/templates/airflow/dags.html 
b/airflow/www/templates/airflow/dags.html
index ba0e35f8c1..a824369769 100644
--- a/airflow/www/templates/airflow/dags.html
+++ b/airflow/www/templates/airflow/dags.html
@@ -80,15 +80,27 @@
   {% for m in dashboard_alerts %}
     {{ show_message(m.message, m.category) }}
   {% endfor %}
-  {% for original_table_name, moved_table_name in migration_moved_data_alerts 
%}
-    {% call show_message(category='error', dismissible=false) %}
-      Airflow found incompatible data in the <code>{{ original_table_name 
}}</code> table in the
-      metadatabase, and has moved them to <code>{{ moved_table_name }}</code> 
during the database migration
-      to upgrade. Please inspect the moved data to decide whether you need to 
keep them, and manually drop
-      the <code>{{ moved_table_name }}</code> table to dismiss this warning. 
Read more about it
+  {% if migration_moved_data_alerts %}
+    {% call show_message(category='warning', dismissible=false) %}
+      While upgrading the metadatabase, Airflow had to move some bad data in 
order to apply new constraints.
+      The moved data can be found in the following tables:<br>
+        <table>
+          <tr>
+            <th style="padding-right:10px">Source table</th>
+            <th>Table with moved rows</th>
+          </tr>
+          {% for original_table_name, moved_table_name in 
migration_moved_data_alerts %}
+            <tr>
+              <td style="padding-right:10px"><code>{{ original_table_name 
}}</code></td>
+              <td><code>{{ moved_table_name }}</code></td>
+            </tr>
+          {% endfor %}
+        </table>
+      Please inspect the moved data to decide whether you need to keep them, 
and manually drop
+      the moved tables to dismiss this warning. Read more about it
       in <a href={{ get_docs_url("installation/upgrading.html") 
}}><b>Upgrading</b></a>.
     {% endcall %}
-  {% endfor %}
+  {% endif %}
   {{ super() }}
   {% if sqlite_warning | default(true) %}
     {% call show_message(category='warning', dismissible=false)  %}
diff --git a/airflow/www/views.py b/airflow/www/views.py
index 2ab0067bb2..b2360fca81 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -829,13 +829,13 @@ class Airflow(AirflowBaseView):
 
         def _iter_parsed_moved_data_table_names():
             for table_name in inspect(session.get_bind()).get_table_names():
-                segments = table_name.split("__", 2)
+                segments = table_name.split("__", 3)
                 if len(segments) < 3:
                     continue
                 if segments[0] != settings.AIRFLOW_MOVED_TABLE_PREFIX:
                     continue
                 # Second segment is a version marker that we don't need to 
show.
-                yield segments[2], table_name
+                yield segments[3], table_name
 
         if (
             permissions.ACTION_CAN_ACCESS_MENU,

Reply via email to