Skip to content

Commit

Permalink
Revert "Fix circular import (#11137)" (#11175)
Browse files Browse the repository at this point in the history
This reverts commit 95c090b.
  • Loading branch information
emmyoop authored Dec 24, 2024
1 parent 459d156 commit 0bf38ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 0 additions & 6 deletions .changes/unreleased/Fixes-20241211-132203.yaml

This file was deleted.

1 change: 1 addition & 0 deletions core/dbt/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .main import cli as dbt_cli # noqa
10 changes: 9 additions & 1 deletion core/dbt/config/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
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
Expand Down Expand Up @@ -165,6 +164,15 @@ 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
Expand Down

0 comments on commit 0bf38ce

Please sign in to comment.