Skip to content

Commit

Permalink
Try fixing NEW_SESSION import in Airflow 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajkoti committed Oct 21, 2024
1 parent 56003df commit 4596929
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,21 @@
from airflow.models.taskinstance import TaskInstance
from airflow.secrets.local_filesystem import LocalFilesystemBackend
from airflow.utils import timezone
from airflow.utils.session import NEW_SESSION, provide_session
from airflow.utils.session import provide_session
from airflow.utils.state import DagRunState, State
from airflow.utils.types import DagRunType
from sqlalchemy.orm.session import Session

try:
from airflow.utils.session import NEW_SESSION
except ImportError:
# Airflow < 2.3 did not have NEW_SESSION in airflow.utils.session
from typing import cast

from airflow import settings

NEW_SESSION: settings.SASession = cast(settings.SASession, None)

log = logging.getLogger(__name__)


Expand Down

0 comments on commit 4596929

Please sign in to comment.