From 6e92fda3705af515293c8c4a9381dcfdfb838081 Mon Sep 17 00:00:00 2001 From: Illia Yurtsiv Date: Mon, 17 Jun 2024 19:58:58 +0300 Subject: [PATCH 1/2] Fix: set ENV VARS as invocation context for dbt >= 1.8 --- src/dbt_osmosis/vendored/dbt_core_interface/project.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dbt_osmosis/vendored/dbt_core_interface/project.py b/src/dbt_osmosis/vendored/dbt_core_interface/project.py index 11af478..4586b11 100644 --- a/src/dbt_osmosis/vendored/dbt_core_interface/project.py +++ b/src/dbt_osmosis/vendored/dbt_core_interface/project.py @@ -87,7 +87,8 @@ try: # dbt >= 1.8 - from dbt_common.clients.system import make_directory + from dbt_common.clients.system import make_directory, get_env + from dbt_common.context import set_invocation_context except ImportError: # dbt < 1.8 from dbt.clients.system import make_directory @@ -386,6 +387,8 @@ def __init__( project_dir=project_dir or DEFAULT_PROJECT_DIR, profile=profile, ) + if hasattr(sys.modules[__name__], 'set_invocation_context'): + set_invocation_context(get_env()) if vars is None: vars = "{}" self.base_config.vars = vars From a9c47ed6ed5807cb73ff4713c9ccb0b26e98baf1 Mon Sep 17 00:00:00 2001 From: Illia Yurtsiv Date: Tue, 18 Jun 2024 00:20:59 +0300 Subject: [PATCH 2/2] fix linting issues --- src/dbt_osmosis/vendored/dbt_core_interface/project.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dbt_osmosis/vendored/dbt_core_interface/project.py b/src/dbt_osmosis/vendored/dbt_core_interface/project.py index 4586b11..9e8e674 100644 --- a/src/dbt_osmosis/vendored/dbt_core_interface/project.py +++ b/src/dbt_osmosis/vendored/dbt_core_interface/project.py @@ -87,11 +87,12 @@ try: # dbt >= 1.8 - from dbt_common.clients.system import make_directory, get_env + from dbt_common.clients.system import get_env, make_directory from dbt_common.context import set_invocation_context except ImportError: # dbt < 1.8 from dbt.clients.system import make_directory + from dbt.config.runtime import RuntimeConfig from dbt.contracts.graph.nodes import ColumnInfo, ManifestNode from dbt.flags import set_from_args @@ -387,7 +388,7 @@ def __init__( project_dir=project_dir or DEFAULT_PROJECT_DIR, profile=profile, ) - if hasattr(sys.modules[__name__], 'set_invocation_context'): + if hasattr(sys.modules[__name__], "set_invocation_context"): set_invocation_context(get_env()) if vars is None: vars = "{}"