I think you'll need a transaction (depending on your DB). Here is sample of what I would use in Postgres:
BEGIN; update xcom set dag_id='new-name' where dag_id = 'old-name'; update task_instance set dag_id='new-name' where dag_id = 'old-name'; update sla_miss set dag_id='new-name' where dag_id = 'old-name'; update log set dag_id='new-name' where dag_id = 'old-name'; update job set dag_id='new-name' where dag_id = 'old-name'; update dag_run set dag_id='new-name' where dag_id = 'old-name'; update dag set dag_id='new-name' where dag_id = 'old-name'; COMMIT; -Michael On Wed, Mar 7, 2018 at 12:09 PM Chris Palmer <[email protected]> wrote: > You'd have to connect to the database storing all the Airflow metadata, > find all the tables with a 'dag_id' column and update all the rows for the > old name to match the new name. > > Chris > > On Wed, Mar 7, 2018 at 2:30 PM, Michael Gong <[email protected]> > wrote: > > > hi, all, > > due to some reasons, we need rename a dag. > > is it possible to keep the dag run history which used the old name? > > > > thanks. > > michael > > >
