diff --git a/.changes/unreleased/Under the Hood-20240412-134502.yaml b/.changes/unreleased/Under the Hood-20240412-134502.yaml new file mode 100644 index 00000000000..62d1ebb859b --- /dev/null +++ b/.changes/unreleased/Under the Hood-20240412-134502.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: Migrate to using `error_tag` provided by `dbt-common` +time: 2024-04-12T13:45:02.879023-07:00 +custom: + Author: QMalcolm + Issue: "9914" diff --git a/core/dbt/events/types.py b/core/dbt/events/types.py index daf114042e7..01b46cc54bf 100644 --- a/core/dbt/events/types.py +++ b/core/dbt/events/types.py @@ -1,7 +1,7 @@ import json from dbt.constants import MAXIMUM_SEED_SIZE_NAME, PIN_PACKAGE_URL -from dbt_common.ui import warning_tag, line_wrap_message, green, yellow, red +from dbt_common.ui import error_tag, warning_tag, line_wrap_message, green, yellow, red from dbt_common.events.base_types import EventLevel from dbt_common.events.format import ( format_fancy_output_line, @@ -11,11 +11,6 @@ from dbt.events.base_types import WarnLevel, InfoLevel, DebugLevel, ErrorLevel, DynamicLevel -# TODO Move this to dbt_common.ui -def _error_tag(msg: str) -> str: - return f'[{red("ERROR")}]: {msg}' - - # Event codes have prefixes which follow this table # # | Code | Description | @@ -430,7 +425,7 @@ def message(self) -> str: ) if self.level == EventLevel.ERROR.value: - description = _error_tag(description) + description = error_tag(description) elif self.level == EventLevel.WARN.value: description = warning_tag(description) @@ -448,7 +443,7 @@ def message(self) -> str: description += " Run again with `--debug` to see them all." if self.level == EventLevel.ERROR.value: - description = _error_tag(description) + description = error_tag(description) elif self.level == EventLevel.WARN.value: description = warning_tag(description) diff --git a/core/setup.py b/core/setup.py index f8b96f2fcaa..7cbbfb7e41e 100644 --- a/core/setup.py +++ b/core/setup.py @@ -75,7 +75,7 @@ "minimal-snowplow-tracker>=0.0.2,<0.1", "dbt-semantic-interfaces>=0.5.1,<0.6", # Minor versions for these are expected to be backwards-compatible - "dbt-common<2.0", + "dbt-common>=1.0.1,<2.0", "dbt-adapters>=0.1.0a2,<2.0", # ---- # Expect compatibility with all new versions of these packages, so lower bounds only.