You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@airflow.apache.org by Michael Gong <go...@gmail.com> on 2018/03/07 19:30:45 UTC

rename DAG, and keep the history

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

Re: rename DAG, and keep the history

Posted by Michael Erdely <mj...@gmail.com>.
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 <ch...@crpalmer.com> 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 <go...@gmail.com>
> 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
> >
>

Re: rename DAG, and keep the history

Posted by Chris Palmer <ch...@crpalmer.com>.
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 <go...@gmail.com>
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
>