Make select
, exclude
, selector
, and models
pseudo-parametrizable via skipping and trigger_rule="none_failed"
#857
Description
Right now it is impossible to pass a Param()
into a DbtDag()
or DbtTaskGroup()
that selects and de-selects models.
The reason why is pretty obvious when you think about it: these params are used to render the tasks in the DbtDag, and rendering does not have access to Jinja templating (only tasks while they are being executed have access).
That said, it could be possible to make accessible some sort of mechanism for raise AirflowSkipException
when a task is excluded via a different mechanism than the DAG rendering. In combination with trigger_rule="none_failed"
, this could provide a mechanism for running subsets of tasks in a DAG via Params, while still having each dbt node correspond with a single Airflow operator.
(The other way to do this, which is by far the easiest way right now and will still have many advantages over this proposal, is to run every selected dbt task inside a single Airflow operator.)
Because of Airflow's internals, the selection of tasks in a DAG cannot be determined via Params, except via dynamic task mapping, which does not support task dependencies. However because skipping and trigger_rule="none_failed"
achieves a similar behavior, this is why I refer to this as making the DbtDag "pseudo-parametrizable".
There are some real challenges here, this isn't as simple as just passing some args into the operators, but it's super-duper feasible and possible to imagine this existing as a feature.
Addendum + notes:
-
Just to be absolutely clear, I am not saying
trigger_rule="none_failed"
should be a default. Obviously not. I'm just saying this is how the behavior could be achieved. -
There is some slightly related discussion in Evaluate alternatives to rendering dbt projects other than during DAG parsing time #520.