Skip to content

Commit

Permalink
fixup! fixup! Add bundle_name to ParseImportError
Browse files Browse the repository at this point in the history
  • Loading branch information
ephraimbuddy committed Jan 14, 2025
1 parent aa8b0da commit 1aa4c7b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
11 changes: 7 additions & 4 deletions airflow/dag_processing/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

import attrs
from setproctitle import setproctitle
from sqlalchemy import and_, delete, select, update
from sqlalchemy import delete, select, tuple_, update
from tabulate import tabulate
from uuid6 import uuid7

Expand Down Expand Up @@ -756,9 +756,12 @@ def clear_nonexistent_import_errors(self, session=NEW_SESSION):

if self._file_paths:
query = query.where(
and_(
ParseImportError.filename.notin_([f.path for f in self._file_paths]),
ParseImportError.bundle_name.notin_([f.bundle_name for f in self._file_paths]),
(
tuple_(
(ParseImportError.filename, ParseImportError.bundle_name).notin_(
[(f.path, f.bundle_name) for f in self._file_paths]
)
),
)
)

Expand Down
13 changes: 7 additions & 6 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
from markupsafe import Markup, escape
from pendulum.datetime import DateTime
from pendulum.parsing.exceptions import ParserError
from sqlalchemy import and_, case, desc, func, inspect, or_, select, union_all
from sqlalchemy import and_, case, desc, func, inspect, or_, select, tuple_, union_all
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import joinedload
from wtforms import BooleanField, validators
Expand Down Expand Up @@ -1017,11 +1017,12 @@ def index(self):
if not can_read_all_dags:
# if the user doesn't have access to all DAGs, only display errors from visible DAGs
import_errors = import_errors.where(
ParseImportError.filename.in_(
select(DagModel.fileloc).distinct().where(DagModel.dag_id.in_(filter_dag_ids))
),
ParseImportError.bundle_name.in_(
select(DagModel.bundle_name).distinct().where(DagModel.dag_id.in_(filter_dag_ids))
tuple_(
(ParseImportError.filename, ParseImportError.bundle_name).in_(
select(DagModel.fileloc, DagModel.bundle_name)
.distinct()
.where(DagModel.dag_id.in_(filter_dag_ids))
)
),
)

Expand Down

0 comments on commit 1aa4c7b

Please sign in to comment.