From ed5d07f970dc91282ad629a615eb6a15256e817e Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 23 Sep 2024 16:40:44 -0700 Subject: [PATCH 1/3] add builder config to node config --- core/dbt/parser/schema_generic_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/dbt/parser/schema_generic_tests.py b/core/dbt/parser/schema_generic_tests.py index 14e2dbc862a..01211183afc 100644 --- a/core/dbt/parser/schema_generic_tests.py +++ b/core/dbt/parser/schema_generic_tests.py @@ -200,7 +200,7 @@ def parse_generic_test( # this is the ContextConfig that is used in render_update config: ContextConfig = self.initial_config(fqn) - + config.add_config_call(builder.config) # builder.args contains keyword args for the test macro, # not configs which have been separated out in the builder. # The keyword args are not completely rendered until compilation. From 33d8aef328d613064490d0518b8d72d66e5282af Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 25 Sep 2024 15:46:43 -0700 Subject: [PATCH 2/3] add changie --- .changes/unreleased/Fixes-20240925-154514.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixes-20240925-154514.yaml diff --git a/.changes/unreleased/Fixes-20240925-154514.yaml b/.changes/unreleased/Fixes-20240925-154514.yaml new file mode 100644 index 00000000000..8db05cc6a0e --- /dev/null +++ b/.changes/unreleased/Fixes-20240925-154514.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Pass test user config to adapter pre_hook by explicitly adding test builder config to node +time: 2024-09-25T15:45:14.459598-07:00 +custom: + Author: colin-rogers-dbt + Issue: "10484" From 90552ca89e4295beb9e9b8f6bb21e14bc8bbada4 Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 25 Sep 2024 19:11:30 -0700 Subject: [PATCH 3/3] raise expected exceptions --- core/dbt/context/context_config.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/dbt/context/context_config.py b/core/dbt/context/context_config.py index caf83d425fe..c77f8d19436 100644 --- a/core/dbt/context/context_config.py +++ b/core/dbt/context/context_config.py @@ -6,9 +6,11 @@ from dbt.adapters.factory import get_config_class_by_name from dbt.config import IsFQNResource, Project, RuntimeConfig from dbt.contracts.graph.model_config import get_config_for +from dbt.exceptions import SchemaConfigError from dbt.node_types import NodeType from dbt.utils import fqn_search from dbt_common.contracts.config.base import BaseConfig, merge_config_dicts +from dbt_common.dataclass_schema import ValidationError from dbt_common.exceptions import DbtInternalError @@ -236,8 +238,12 @@ def calculate_node_config_dict( base=base, patch_config_dict=patch_config_dict, ) - finalized = config.finalize_and_validate() - return finalized.to_dict(omit_none=True) + try: + finalized = config.finalize_and_validate() + return finalized.to_dict(omit_none=True) + except ValidationError as exc: + # we got a ValidationError - probably bad types in config() + raise SchemaConfigError(exc, node=config) from exc class UnrenderedConfigGenerator(BaseContextConfigGenerator[Dict[str, Any]]):