diff --git a/cosmos/operators/local.py b/cosmos/operators/local.py index d74cfbe44..c033f33f3 100644 --- a/cosmos/operators/local.py +++ b/cosmos/operators/local.py @@ -109,6 +109,7 @@ def __init__( self.compiled_sql = "" self.should_store_compiled_sql = should_store_compiled_sql self.openlineage_events_completes: list[RunEvent] = [] + kwargs.pop("full_refresh", None) # usage of this param should be implemented in child classes super().__init__(**kwargs) @cached_property diff --git a/dev/dags/basic_cosmos_dag.py b/dev/dags/basic_cosmos_dag.py index 99f6b44e3..8bd49b0b3 100644 --- a/dev/dags/basic_cosmos_dag.py +++ b/dev/dags/basic_cosmos_dag.py @@ -28,7 +28,10 @@ DBT_ROOT_PATH / "jaffle_shop", ), profile_config=profile_config, - operator_args={"install_deps": True}, + operator_args={ + "install_deps": True, # install any necessary dependencies before running any dbt command + "full_refresh": True, # used only in dbt commands that support this flag + }, # normal dag parameters schedule_interval="@daily", start_date=datetime(2023, 1, 1), diff --git a/tests/operators/test_local.py b/tests/operators/test_local.py index 0898a2894..e5f210c53 100644 --- a/tests/operators/test_local.py +++ b/tests/operators/test_local.py @@ -332,6 +332,7 @@ def test_store_compiled_sql() -> None: [ (DbtSeedLocalOperator, {"full_refresh": True}, {"context": {}, "cmd_flags": ["--full-refresh"]}), (DbtRunLocalOperator, {"full_refresh": True}, {"context": {}, "cmd_flags": ["--full-refresh"]}), + (DbtTestLocalOperator, {"full_refresh": True}, {"context": {}}), ( DbtRunOperationLocalOperator, {"args": {"days": 7, "dry_run": True}, "macro_name": "bla"},