You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor group_nodes_by_folder hierarchical naming to be opt-in (#2862)
#2824 fixed `group_nodes_by_folder` collapsing folders that share a leaf
name under different parents (e.g. `staging/aurora` and `marts/aurora`)
— thanks @anor4k for catching and fixing this!
My only concern is that it changes the names of the generated Cosmos
task groups, which is a breaking change for users who reference those
task groups from other tasks, e.g.:
```
non_cosmos_task = ...
cosmos_dbt_task_group = task_group.children["tg_a.models"].children["tg_a.models.marts"]
non_cosmos_task >> cosmos_dbt_task_group
```
To avoid this breaking change in a 1.x release, this PR makes the fix
configurable, defaulting it to `False` and following the same config
pattern as the existing Cosmos settings:
https://astronomer.github.io/astronomer-cosmos/reference/configs/cosmos-conf.html
When `enable_hierarchical_naming_for_group_nodes_by_folder` is disabled
(the default), Cosmos keeps the previous task-group names. When it is
enabled — through the setting or the
`AIRFLOW__COSMOS__ENABLE_HIERARCHICAL_NAMING_FOR_GROUP_NODES_BY_FOLDER`
environment variable — Cosmos applies the #2824 fix, and folders that
share a leaf name render as distinct task groups.
We intend to make hierarchical naming the only behaviour, and drop this
setting altogether, in Cosmos 2.0: #2863
Copy file name to clipboardExpand all lines: docs/guides/translate_dbt_to_airflow/render-config.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ The ``RenderConfig`` class takes the following arguments:
33
33
- ``should_detach_multiple_parents_tests``: A boolean to control if tests that depend on multiple parents should be run as standalone tasks. See :doc:`Testing Behavior </guides/translate_dbt_to_airflow/testing-behavior>` for more information.
34
34
- ``enable_owner_inheritance``: (introduced in 1.10.2) A boolean to control if dbt owners should be imported as part of the airflow DAG owners. Defaults to True.
35
35
- ``ephemeral_models_as_empty_operator``: (new in v1.15.0) A boolean to control how ephemeral models are rendered. Ephemeral models are inlined as CTEs into downstream models and never written to the warehouse, so running them via a dbt operator is effectively a no-op. When ``True`` (default), they are rendered as ``EmptyOperator`` tasks, which preserves the dependency chain that passes through them while avoiding wasted dbt invocations and decluttering the DAG. Because the ``EmptyOperator`` does not run dbt, behaviour tied to the ephemeral model's run task no longer occurs: no Airflow Dataset/Asset is emitted for it (so dataset-scheduled DAGs keyed on it are not triggered), task callbacks are not invoked, no OpenLineage events are produced, and per-node operator arguments (e.g. ``profile_args``) do not apply. Set to ``False`` to render them as regular dbt run tasks.
36
-
- ``group_nodes_by_folder``: When enabled, groups nodes by folder structure, creating a ``TaskGroup`` per resource type and folder. Disabled by default.
36
+
- ``group_nodes_by_folder``: When enabled, groups nodes by folder structure, creating a ``TaskGroup`` per resource type and folder. Disabled by default. By default, folders that share a leaf name under different parents (e.g. ``staging/aurora`` and ``marts/aurora``) collapse into a single task group; set the :ref:`enable_hierarchical_naming_for_group_nodes_by_folder` Cosmos config (or the ``AIRFLOW__COSMOS__ENABLE_HIERARCHICAL_NAMING_FOR_GROUP_NODES_BY_FOLDER`` environment variable) to ``True`` to render them as distinct task groups. It is disabled by default because enabling it changes task-group ids, which is a breaking change for DAGs that reference Cosmos task groups by id, and is expected to become the default in Cosmos 2.0.
0 commit comments