diff --git a/.changes/unreleased/Features-20220919-112903.yaml b/.changes/unreleased/Features-20220919-112903.yaml new file mode 100644 index 00000000000..b6a2c69c65a --- /dev/null +++ b/.changes/unreleased/Features-20220919-112903.yaml @@ -0,0 +1,7 @@ +kind: Features +body: add -fr flag shorthand +time: 2022-09-19T11:29:03.774678-05:00 +custom: + Author: dave-connors-3 + Issue: "5878" + PR: "5879" diff --git a/core/dbt/cli/params.py b/core/dbt/cli/params.py index 68b3b0b8bf0..601cb39faf2 100644 --- a/core/dbt/cli/params.py +++ b/core/dbt/cli/params.py @@ -97,6 +97,7 @@ full_refresh = click.option( "--full-refresh", + "-fr", envvar="DBT_FULL_REFRESH", help="If specified, dbt will drop incremental models and fully-recalculate the incremental table from the model definition.", is_flag=True, diff --git a/core/dbt/main.py b/core/dbt/main.py index 5be5151bc0c..0e4102e0e0d 100644 --- a/core/dbt/main.py +++ b/core/dbt/main.py @@ -620,6 +620,7 @@ def _add_table_mutability_arguments(*subparsers): for sub in subparsers: sub.add_argument( "--full-refresh", + "-fr", action="store_true", help=""" If specified, dbt will drop incremental models and diff --git a/tests/functional/materializations/test_runtime_materialization.py b/tests/functional/materializations/test_runtime_materialization.py index d73db785385..cad0d292859 100644 --- a/tests/functional/materializations/test_runtime_materialization.py +++ b/tests/functional/materializations/test_runtime_materialization.py @@ -138,20 +138,20 @@ def test_full_refresh( project, ): # initial full-refresh should have no effect - results = run_dbt(["run", "--full-refresh"]) + results = run_dbt(["run", "-fr"]) assert len(results) == 3 check_relations_equal(project.adapter, ["seed", "view", "incremental", "materialized"]) # adds one record to the incremental model. full-refresh should truncate then re-run project.run_sql(invalidate_incremental_sql) - results = run_dbt(["run", "--full-refresh"]) + results = run_dbt(["run", "-fr"]) assert len(results) == 3 check_relations_equal(project.adapter, ["seed", "incremental"]) project.run_sql(update_sql) - results = run_dbt(["run", "--full-refresh"]) + results = run_dbt(["run", "-fr"]) assert len(results) == 3 check_relations_equal(project.adapter, ["seed", "view", "incremental", "materialized"]) @@ -181,7 +181,7 @@ def test_delete_dbt_tmp_relation( project.run_sql(create_incremental__dbt_tmp_sql) assert len(results) == 1 - results = run_dbt(["run", "--model", "incremental", "--full-refresh"]) + results = run_dbt(["run", "--model", "incremental", "-fr"]) assert len(results) == 1 check_table_does_not_exist(project.adapter, "incremental__dbt_tmp")