From 92339758b26e21654cd77c1adfa522e32855eb13 Mon Sep 17 00:00:00 2001 From: Michelle Ark Date: Sat, 15 Jun 2024 10:56:45 -0400 Subject: [PATCH 1/2] add empty to context flags --- core/dbt/flags.py | 1 + tests/unit/context/test_base.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/core/dbt/flags.py b/core/dbt/flags.py index bcacf5d3e8f..97ee9598f2f 100644 --- a/core/dbt/flags.py +++ b/core/dbt/flags.py @@ -68,6 +68,7 @@ def get_flag_dict(): "target_path", "log_path", "invocation_command", + "empty", } return {key: getattr(GLOBAL_FLAGS, key.upper(), None) for key in flag_attr} diff --git a/tests/unit/context/test_base.py b/tests/unit/context/test_base.py index 2246c1f77ff..5a9e8538ea2 100644 --- a/tests/unit/context/test_base.py +++ b/tests/unit/context/test_base.py @@ -21,3 +21,34 @@ def test_log_with_dbt_env_secret(self): BaseContext.log({"fact1": "I like cats"}, info=True) except Exception as e: assert False, f"Logging while a `DBT_ENV_SECRET` was set raised an exception: {e}" + + def test_flags(self): + expected_context_flags = { + "use_experimental_parser", + "static_parser", + "warn_error", + "warn_error_options", + "write_json", + "partial_parse", + "use_colors", + "profiles_dir", + "debug", + "log_format", + "version_check", + "fail_fast", + "send_anonymous_usage_stats", + "printer_width", + "indirect_selection", + "log_cache_events", + "quiet", + "no_print", + "cache_selected_only", + "introspect", + "target_path", + "log_path", + "invocation_command", + "empty", + } + flags = BaseContext(cli_vars={}).flags + for expected_flag in expected_context_flags: + assert hasattr(flags, expected_flag.upper()) From ace8aca8d8625d550f1afa34db808fa3c296bc22 Mon Sep 17 00:00:00 2001 From: Michelle Ark Date: Mon, 17 Jun 2024 10:39:52 -0400 Subject: [PATCH 2/2] changelog entry --- .changes/unreleased/Features-20240617-103948.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Features-20240617-103948.yaml diff --git a/.changes/unreleased/Features-20240617-103948.yaml b/.changes/unreleased/Features-20240617-103948.yaml new file mode 100644 index 00000000000..a64867d569a --- /dev/null +++ b/.changes/unreleased/Features-20240617-103948.yaml @@ -0,0 +1,6 @@ +kind: Features +body: add --empty value to jinja context as flags.EMPTY +time: 2024-06-17T10:39:48.275801-04:00 +custom: + Author: michelleark + Issue: "10317"