Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: ensure bool(LazySelectSequence) returns True or False #43978

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion airflow/utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,9 @@ def __setstate__(self, state: Any) -> None:
self._session = get_current_task_instance_session()

def __bool__(self) -> bool:
return check_query_exists(self._select_asc, session=self._session)
if check := check_query_exists(self._select_asc, session=self._session) is not None:
johncmerfeld marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a second, though, shouldn't we just handle it in check_query_exists? That function states it should return bool

return check
return False

def __eq__(self, other: Any) -> bool:
if not isinstance(other, collections.abc.Sequence):
Expand Down