Skip to content

Commit

Permalink
Merge branch 'main' into kubernetes_on_warning_callback
Browse files Browse the repository at this point in the history
  • Loading branch information
tatiana authored Nov 16, 2023
2 parents 5e79dd8 + 709ba44 commit 6a153dc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cosmos/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class ExecutionConfig:

execution_mode: ExecutionMode = ExecutionMode.LOCAL
test_indirect_selection: TestIndirectSelection = TestIndirectSelection.EAGER
dbt_executable_path: str | Path = get_system_dbt()
dbt_executable_path: str | Path = field(default_factory=get_system_dbt)

dbt_project_path: InitVar[str | Path | None] = None

Expand Down
9 changes: 8 additions & 1 deletion docs/getting_started/mwaa.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ In your ``my_cosmos_dag.py`` file, import the ``DbtDag`` class from Cosmos and c

.. code-block:: python
from cosmos import DbtDag, ProjectConfig, ProfileConfig
from cosmos import DbtDag, ProjectConfig, ProfileConfig, ExecutionConfig
from cosmos.profiles import PostgresUserPasswordProfileMapping
from cosmos.constants import ExecutionMode
profile_config = ProfileConfig(
profile_name="default",
Expand All @@ -99,11 +100,17 @@ In your ``my_cosmos_dag.py`` file, import the ``DbtDag`` class from Cosmos and c
),
)
execution_config = ExecutionConfig(
dbt_executable_path=f"{os.environ['AIRFLOW_HOME']}/dbt_venv/bin/dbt",
execution_mode=ExecutionMode.VIRTUALENV,
)
my_cosmos_dag = DbtDag(
project_config=ProjectConfig(
"<my_dbt_project>",
),
profile_config=profile_config,
execution_config=execution_config,
# normal dag parameters
schedule_interval="@daily",
start_date=datetime(2023, 1, 1),
Expand Down
3 changes: 2 additions & 1 deletion tests/dbt/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ def test_load_via_dbt_ls_without_profile(mock_validate_dbt_command):
assert err_info.value.args[0] == expected


def test_load_via_dbt_ls_with_invalid_dbt_path():
@patch("cosmos.dbt.executable.shutil.which", return_value=None)
def test_load_via_dbt_ls_with_invalid_dbt_path(mock_which):
project_config = ProjectConfig(dbt_project_path=DBT_PROJECTS_ROOT_DIR / DBT_PROJECT_NAME)
execution_config = ExecutionConfig(dbt_project_path=DBT_PROJECTS_ROOT_DIR / DBT_PROJECT_NAME)
render_config = RenderConfig(
Expand Down

0 comments on commit 6a153dc

Please sign in to comment.