Skip to content

Commit

Permalink
add warn_once
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-rogers-dbt committed Sep 20, 2024
1 parent 98ccfce commit 678d5dd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dbt_common/behavior_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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
Expand All @@ -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:
"""
Expand Down

0 comments on commit 678d5dd

Please sign in to comment.