chore: 移除临时的数据库维护脚本 clean_dags_db.py,防止 Airflow 3.0 沙箱限制报错
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
from airflow.models.serialized_dag import SerializedDagModel
|
||||
from airflow.models.dag import DagModel
|
||||
from airflow.utils.session import create_session
|
||||
from sqlalchemy import or_
|
||||
|
||||
print("Starting surgical cleanup of ALL example_* DAGs in database...")
|
||||
|
||||
with create_session() as session:
|
||||
# 1. Clean SerializedDagModel where dag_id starts with 'example_' or contains 'workday'
|
||||
d1 = session.query(SerializedDagModel).filter(
|
||||
or_(
|
||||
SerializedDagModel.dag_id.like('example_%'),
|
||||
SerializedDagModel.dag_id.like('%workday%'),
|
||||
SerializedDagModel.dag_id.like('%example_time_table%')
|
||||
)
|
||||
).all()
|
||||
for d in d1:
|
||||
print('Deleting serialized:', d.dag_id)
|
||||
session.delete(d)
|
||||
|
||||
# 2. Clean DagModel where dag_id starts with 'example_' or contains 'workday'
|
||||
d2 = session.query(DagModel).filter(
|
||||
or_(
|
||||
DagModel.dag_id.like('example_%'),
|
||||
DagModel.dag_id.like('%workday%'),
|
||||
DagModel.dag_id.like('%example_time_table%')
|
||||
)
|
||||
).all()
|
||||
for d in d2:
|
||||
print('Deleting DagModel:', d.dag_id)
|
||||
session.delete(d)
|
||||
|
||||
session.commit()
|
||||
print('Clean completed successfully!')
|
||||
Reference in New Issue
Block a user