From 1231807e492f0b19a669df41b07c6215fdc25a66 Mon Sep 17 00:00:00 2001 From: Daniel Radetsky Date: Wed, 11 Dec 2024 13:21:32 -0800 Subject: [PATCH 1/3] fix circular import --- core/dbt/cli/__init__.py | 1 - core/dbt/config/profile.py | 10 +--------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/core/dbt/cli/__init__.py b/core/dbt/cli/__init__.py index 8dc5c408aa2..e69de29bb2d 100644 --- a/core/dbt/cli/__init__.py +++ b/core/dbt/cli/__init__.py @@ -1 +0,0 @@ -from .main import cli as dbt_cli # noqa diff --git a/core/dbt/config/profile.py b/core/dbt/config/profile.py index ada7f30711c..f4bee703154 100644 --- a/core/dbt/config/profile.py +++ b/core/dbt/config/profile.py @@ -3,6 +3,7 @@ from typing import Any, Dict, Optional, Tuple from dbt.adapters.contracts.connection import Credentials, HasCredentials +from dbt.cli.resolvers import default_profiles_dir from dbt.clients.yaml_helper import load_yaml_text from dbt.contracts.project import ProfileConfig from dbt.events.types import MissingProfileTarget @@ -164,15 +165,6 @@ def pick_profile_name( args_profile_name: Optional[str], project_profile_name: Optional[str] = None, ) -> str: - # TODO: Duplicating this method as direct copy of the implementation in dbt.cli.resolvers - # dbt.cli.resolvers implementation can't be used because it causes a circular dependency. - # This should be removed and use a safe default access on the Flags module when - # https://github.com/dbt-labs/dbt-core/issues/6259 is closed. - def default_profiles_dir(): - from pathlib import Path - - return Path.cwd() if (Path.cwd() / "profiles.yml").exists() else Path.home() / ".dbt" - profile_name = project_profile_name if args_profile_name is not None: profile_name = args_profile_name From 5789e47d2646da525d05a1edc8847f6e90ffec0a Mon Sep 17 00:00:00 2001 From: Daniel Radetsky Date: Wed, 11 Dec 2024 13:22:24 -0800 Subject: [PATCH 2/3] changelog --- .changes/unreleased/Fixes-20241211-132203.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixes-20241211-132203.yaml diff --git a/.changes/unreleased/Fixes-20241211-132203.yaml b/.changes/unreleased/Fixes-20241211-132203.yaml new file mode 100644 index 00000000000..a9984877811 --- /dev/null +++ b/.changes/unreleased/Fixes-20241211-132203.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Fix circular dependency +time: 2024-12-11T13:22:03.637443979-08:00 +custom: + Author: dradetsky + Issue: none From f89980b590aae97b573215e5e3a2c6ae25c05ecb Mon Sep 17 00:00:00 2001 From: Doug Beatty <44704949+dbeatty10@users.noreply.github.com> Date: Thu, 12 Dec 2024 09:12:09 -0700 Subject: [PATCH 3/3] Add GitHub issue number --- .changes/unreleased/Fixes-20241211-132203.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changes/unreleased/Fixes-20241211-132203.yaml b/.changes/unreleased/Fixes-20241211-132203.yaml index a9984877811..de936fbdd47 100644 --- a/.changes/unreleased/Fixes-20241211-132203.yaml +++ b/.changes/unreleased/Fixes-20241211-132203.yaml @@ -3,4 +3,4 @@ body: Fix circular dependency time: 2024-12-11T13:22:03.637443979-08:00 custom: Author: dradetsky - Issue: none + Issue: 11142