diff --git a/.changes/unreleased/Features-20230623-111254.yaml b/.changes/unreleased/Features-20230623-111254.yaml new file mode 100644 index 00000000000..9a16636e525 --- /dev/null +++ b/.changes/unreleased/Features-20230623-111254.yaml @@ -0,0 +1,6 @@ +kind: Features +body: Add invocation_command to flags +time: 2023-06-23T11:12:54.523157-07:00 +custom: + Author: NiallRees + Issue: "6051" diff --git a/core/dbt/cli/flags.py b/core/dbt/cli/flags.py index a16829fc79f..c17f3c6c2d5 100644 --- a/core/dbt/cli/flags.py +++ b/core/dbt/cli/flags.py @@ -206,6 +206,9 @@ def _assign_params( profiles_dir = getattr(self, "PROFILES_DIR", None) user_config = read_user_config(profiles_dir) if profiles_dir else None + # Add entire invocation command to flags + object.__setattr__(self, "INVOCATION_COMMAND", "dbt " + " ".join(sys.argv[1:])) + # Overwrite default assignments with user config if available. if user_config: param_assigned_from_default_copy = params_assigned_from_default.copy() diff --git a/core/dbt/flags.py b/core/dbt/flags.py index 37462659c97..891d510f2e1 100644 --- a/core/dbt/flags.py +++ b/core/dbt/flags.py @@ -87,6 +87,7 @@ def get_flag_dict(): "introspect", "target_path", "log_path", + "invocation_command", } return {key: getattr(GLOBAL_FLAGS, key.upper(), None) for key in flag_attr}