From 678d5dda6ac3b02a1770bfbdbbd5351695ce6d82 Mon Sep 17 00:00:00 2001 From: Colin Date: Fri, 20 Sep 2024 13:00:56 -0700 Subject: [PATCH] add warn_once --- dbt_common/behavior_flags.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dbt_common/behavior_flags.py b/dbt_common/behavior_flags.py index a2eb097..94a4ba2 100644 --- a/dbt_common/behavior_flags.py +++ b/dbt_common/behavior_flags.py @@ -47,6 +47,7 @@ class BehaviorFlagRendered: """ def __init__(self, flag: BehaviorFlag, user_overrides: Dict[str, Any]) -> None: + self._warn_once = None self._validate(flag) self.name = flag["name"] @@ -74,6 +75,8 @@ def _validate(flag: BehaviorFlag) -> None: def setting(self) -> bool: if self._setting is False: fire_event(self._behavior_change_event) + if self._warn_once: + self._setting = True return self._setting @setting.setter @@ -84,6 +87,10 @@ def setting(self, value: bool) -> None: def no_warn(self) -> bool: return self._setting + @property + def warn_once(self) -> None: + self._warn_once = True + @staticmethod def _default_source() -> str: """