From a4964389f5edf4f4620b44da9b1289aa34b82d4e Mon Sep 17 00:00:00 2001 From: Quigley Malcolm Date: Thu, 1 Feb 2024 16:22:22 -0800 Subject: [PATCH] Begin using `Mergeable` supplied by `dbt-common` We're currently in the process of moving the "data resource" portion on nodes to `dbt/artifacts`. Some of those artifacts depend on `Mergeable` which has been defined on core. In order to move the data resources to `dbt/artifacts`, we thus need to move `Mergeable` upstream of core. We moved `Mergeable` to [dbt-common](https://github.com/dbt-labs/dbt-common) in https://github.com/dbt-labs/dbt-common/pull/59, and released this change in [dbt-common 0.1.3](https://pypi.org/project/dbt-common/0.1.3/). As such as, in order to unblock some of the `dbt/artifacts` migration work, we first need to update references to `Mergeable` in core to use the `dbt-common` definition. NOTE: We include changing over to `Replaceable` from `dbt-common` in this commit. This is because there wasn't a clean way to do it. If I moved the imports of `Replaceable` on in the files where we updated `Mergeable` then we would have left `Replaceable` in an inbetween state. If we had moved all instances of `Replaceable`, it'd be out of scope for the change. As such, it makes more sense to do that as a separate changeset. --- .changes/unreleased/Under the Hood-20240201-125416.yaml | 6 ++++++ core/dbt/contracts/graph/unparsed.py | 6 ++---- core/dbt/contracts/project.py | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 .changes/unreleased/Under the Hood-20240201-125416.yaml diff --git a/.changes/unreleased/Under the Hood-20240201-125416.yaml b/.changes/unreleased/Under the Hood-20240201-125416.yaml new file mode 100644 index 00000000000..ae1fab79ab7 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20240201-125416.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: Start using `Mergeable` from dbt-common +time: 2024-02-01T12:54:16.462414-08:00 +custom: + Author: QMalcolm + Issue: "9505" diff --git a/core/dbt/contracts/graph/unparsed.py b/core/dbt/contracts/graph/unparsed.py index a5ddf70560b..ba78f2d4860 100644 --- a/core/dbt/contracts/graph/unparsed.py +++ b/core/dbt/contracts/graph/unparsed.py @@ -7,6 +7,7 @@ AdditionalPropertiesAllowed, AdditionalPropertiesMixin, ) +from dbt_common.contracts.util import Mergeable from dbt_common.exceptions import DbtInternalError, CompilationError from dbt_common.dataclass_schema import ( dbtClassMixin, @@ -22,10 +23,7 @@ MaturityType, MeasureAggregationParameters, ) -from dbt.contracts.util import ( - Mergeable, - Replaceable, -) +from dbt.contracts.util import Replaceable # trigger the PathEncoder import dbt_common.helper_types # noqa:F401 diff --git a/core/dbt/contracts/project.py b/core/dbt/contracts/project.py index 33db4e73fcf..01c2f063980 100644 --- a/core/dbt/contracts/project.py +++ b/core/dbt/contracts/project.py @@ -1,7 +1,8 @@ from dbt import deprecations -from dbt.contracts.util import Replaceable, Mergeable, list_str, Identifier +from dbt.contracts.util import Replaceable, list_str, Identifier from dbt.adapters.contracts.connection import QueryComment from dbt_common.helper_types import NoValue +from dbt_common.contracts.util import Mergeable from dbt_common.dataclass_schema import ( dbtClassMixin, ValidationError,