Skip to content

Commit

Permalink
Fix SQLA deprecations in Airflow core (#39211)
Browse files Browse the repository at this point in the history
  • Loading branch information
dondaum authored Apr 25, 2024
1 parent d08f893 commit 6cb9def
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions airflow/utils/db_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ def _do_delete(*, query, orm_model, skip_archive, session):
session.execute(delete)
session.commit()
if skip_archive:
metadata.bind = session.get_bind()
target_table.drop()
bind = session.get_bind()
target_table.drop(bind=bind)
session.commit()
print("Finished Performing Delete")

Expand Down
8 changes: 3 additions & 5 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,9 +846,7 @@ def index(self):

is_paused_count = dict(
session.execute(
all_dags.with_only_columns([DagModel.is_paused, func.count()]).group_by(
DagModel.is_paused
)
all_dags.with_only_columns(DagModel.is_paused, func.count()).group_by(DagModel.is_paused)
).all()
)

Expand Down Expand Up @@ -3294,7 +3292,7 @@ def next_run_datasets(self, dag_id):
latest_run = dag_model.get_last_dagrun(session=session)

events = [
dict(info)
dict(info._mapping)
for info in session.execute(
select(
DatasetModel.id,
Expand Down Expand Up @@ -3456,7 +3454,7 @@ def datasets_summary(self):
count_query = count_query.where(*filters)

query = session.execute(query)
datasets = [dict(dataset) for dataset in query]
datasets = [dict(dataset._mapping) for dataset in query]
data = {"datasets": datasets, "total_entries": session.scalar(count_query)}

return (
Expand Down

0 comments on commit 6cb9def

Please sign in to comment.