Skip to content

Commit

Permalink
Update the default value for the dbt_root_path (#256)
Browse files Browse the repository at this point in the history
This has been throwing a lot of customers off ever since we changed the
dbt parent to be within `/dags`. Proposing that we change the default to
match our docs.

---------

Co-authored-by: Julian LaNeve <lanevejulian@gmail.com>
  • Loading branch information
chrishronek and jlaneve authored Apr 28, 2023
1 parent e67bcbc commit 7df2b1d
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cosmos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Astronomer Cosmos is a library for rendering 3rd party workflows in Airflow.
"""

__version__ = "0.6.2"
__version__ = "0.6.3"
2 changes: 1 addition & 1 deletion cosmos/providers/dbt/dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(
dbt_args: Dict[str, Any] = {},
operator_args: Dict[str, Any] = {},
emit_datasets: bool = True,
dbt_root_path: str = "/usr/local/airflow/dbt",
dbt_root_path: str = "/usr/local/airflow/dags/dbt",
dbt_models_dir: str = "models",
dbt_seeds_dir: str = "seeds",
test_behavior: Literal["none", "after_each", "after_all"] = "after_each",
Expand Down
2 changes: 1 addition & 1 deletion cosmos/providers/dbt/parser/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class DbtProject:
project_name: str

# optional, user-specified instance variables
dbt_root_path: str = "/usr/local/airflow/dbt"
dbt_root_path: str = "/usr/local/airflow/dags/dbt"
dbt_models_dir: str = "models"
dbt_snapshots_dir: str = "snapshots"
dbt_seeds_dir: str = "seeds"
Expand Down
4 changes: 2 additions & 2 deletions cosmos/providers/dbt/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def calculate_operator_class(

def render_project(
dbt_project_name: str,
dbt_root_path: str = "/usr/local/airflow/dbt",
dbt_root_path: str = "/usr/local/airflow/dags/dbt",
dbt_models_dir: str = "models",
dbt_snapshots_dir: str = "snapshots",
dbt_seeds_dir: str = "seeds",
Expand All @@ -46,7 +46,7 @@ def render_project(
Turn a dbt project into a Group
:param dbt_project_name: The name of the dbt project
:param dbt_root_path: The root path to your dbt folder. Defaults to /usr/local/airflow/dbt
:param dbt_root_path: The root path to your dbt folder. Defaults to /usr/local/airflow/dags/dbt
:param task_args: Arguments to pass to the underlying dbt operators
:param operator_args: Parameters to pass to the underlying operators, can include KubernetesPodOperator
or DockerOperator parameters
Expand Down
2 changes: 1 addition & 1 deletion cosmos/providers/dbt/task_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(
dbt_args: Dict[str, Any] = {},
operator_args: Dict[str, Any] = {},
emit_datasets: bool = True,
dbt_root_path: str = "/usr/local/airflow/dbt",
dbt_root_path: str = "/usr/local/airflow/dags/dbt",
dbt_models_dir: str = "models",
dbt_snapshots_dir: str = "snapshots",
dbt_seeds_dir: str = "seeds",
Expand Down
2 changes: 1 addition & 1 deletion docs/dbt/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Usage

Cosmos supports two standard way of rendering dbt projects: either as a full DAG or as a Task Group.

By default, Cosmos will look in the ``/usr/local/airflow/dbt`` directory (next to the ``dags`` folder if you're using the `Astro CLI <https://github.com/astronomer/astro-cli>`_). You can override this using the ``dbt_root_path`` argument in either :class:`cosmos.providers.dbt.DbtDag` or :class:`cosmos.providers.dbt.DbtTaskGroup`. You can also override the default models directory, which is ``"models"`` by default, using the ``dbt_models_dir`` argument.
By default, Cosmos will look in the ``/usr/local/airflow/dags/dbt`` directory (next to the ``dags`` folder if you're using the `Astro CLI <https://github.com/astronomer/astro-cli>`_). You can override this using the ``dbt_root_path`` argument in either :class:`cosmos.providers.dbt.DbtDag` or :class:`cosmos.providers.dbt.DbtTaskGroup`. You can also override the default models directory, which is ``"models"`` by default, using the ``dbt_models_dir`` argument.

Rendering
+++++++++
Expand Down

0 comments on commit 7df2b1d

Please sign in to comment.