Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

remove duplicated consts and methods #521

Merged
merged 1 commit into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions data_diff/dbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import keyring

from .cloud import DatafoldAPI, TCloudApiDataDiff, get_or_create_data_source
from .dbt_parser import DbtParser
from .dbt_parser import DbtParser, PROJECT_FILE


logger = getLogger(__name__)
Expand Down Expand Up @@ -42,29 +42,6 @@ def import_dbt():
from .utils import run_as_daemon, truncate_error
from . import connect_to_table, diff_tables, Algorithm

RUN_RESULTS_PATH = "target/run_results.json"
MANIFEST_PATH = "target/manifest.json"
PROJECT_FILE = "dbt_project.yml"
PROFILES_FILE = "profiles.yml"
LOWER_DBT_V = "1.0.0"
UPPER_DBT_V = "1.4.6"


# https://github.com/dbt-labs/dbt-core/blob/c952d44ec5c2506995fbad75320acbae49125d3d/core/dbt/cli/resolvers.py#L6
def default_project_dir() -> Path:
paths = list(Path.cwd().parents)
paths.insert(0, Path.cwd())
return next((x for x in paths if (x / PROJECT_FILE).exists()), Path.cwd())


# https://github.com/dbt-labs/dbt-core/blob/c952d44ec5c2506995fbad75320acbae49125d3d/core/dbt/cli/resolvers.py#L12
def default_profiles_dir() -> Path:
return Path.cwd() if (Path.cwd() / PROFILES_FILE).exists() else Path.home() / ".dbt"


def legacy_profiles_dir() -> Path:
return Path.home() / ".dbt"


@dataclass
class DiffVars:
Expand Down
7 changes: 4 additions & 3 deletions tests/test_dbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
_local_diff,
_cloud_diff,
DbtParser,
RUN_RESULTS_PATH,
MANIFEST_PATH,
PROJECT_FILE,
DiffVars,
DatafoldAPI,
)
from data_diff.dbt_parser import (
RUN_RESULTS_PATH,
PROJECT_FILE,
)
import unittest
from unittest.mock import MagicMock, Mock, mock_open, patch, ANY

Expand Down