Skip to content

Commit

Permalink
Handle XCom value errors in FAB's XCom list view (#44275)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaxil authored Nov 22, 2024
1 parent 8f567ec commit cf26561
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 13 additions & 4 deletions airflow/www/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,10 +765,8 @@ class AirflowFilterConverter(fab_sqlafilters.SQLAFilterConverter):
),
# FAB will try to create filters for extendedjson fields even though we
# exclude them from all UI, so we add this here to make it ignore them.
(
"is_extendedjson",
[],
),
("is_extendedjson", []),
("is_json", []),
*fab_sqlafilters.SQLAFilterConverter.conversion_table,
)

Expand Down Expand Up @@ -833,6 +831,17 @@ def is_extendedjson(self, col_name):
)
return False

def is_json(self, col_name):
"""Check if it is a JSON type."""
from sqlalchemy import JSON

if col_name in self.list_columns:
obj = self.list_columns[col_name].type
return (
isinstance(obj, JSON) or isinstance(obj, types.TypeDecorator) and isinstance(obj.impl, JSON)
)
return False

def get_col_default(self, col_name: str) -> Any:
if col_name not in self.list_columns:
# Handle AssociationProxy etc, or anything that isn't a "real" column
Expand Down
2 changes: 2 additions & 0 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3879,6 +3879,8 @@ class XComModelView(AirflowModelView):
permissions.ACTION_CAN_ACCESS_MENU,
]

add_exclude_columns = edit_exclude_columns = ["value"]

search_columns = ["key", "timestamp", "dag_id", "task_id", "run_id", "logical_date"]
list_columns = ["key", "value", "timestamp", "dag_id", "task_id", "run_id", "map_index", "logical_date"]
base_order = ("dag_run_id", "desc")
Expand Down

0 comments on commit cf26561

Please sign in to comment.