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

Commit 2f3e83d

Browse files
authored
Merge pull request #521 from dlawin/remove_duplicated_dbt_code
remove duplicated consts and methods
2 parents ca9cd05 + c3f61c3 commit 2f3e83d

File tree

2 files changed

+5
-27
lines changed

2 files changed

+5
-27
lines changed

data_diff/dbt.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import keyring
1313

1414
from .cloud import DatafoldAPI, TCloudApiDataDiff, get_or_create_data_source
15-
from .dbt_parser import DbtParser
15+
from .dbt_parser import DbtParser, PROJECT_FILE
1616

1717

1818
logger = getLogger(__name__)
@@ -42,29 +42,6 @@ def import_dbt():
4242
from .utils import run_as_daemon, truncate_error
4343
from . import connect_to_table, diff_tables, Algorithm
4444

45-
RUN_RESULTS_PATH = "target/run_results.json"
46-
MANIFEST_PATH = "target/manifest.json"
47-
PROJECT_FILE = "dbt_project.yml"
48-
PROFILES_FILE = "profiles.yml"
49-
LOWER_DBT_V = "1.0.0"
50-
UPPER_DBT_V = "1.4.6"
51-
52-
53-
# https://github.com/dbt-labs/dbt-core/blob/c952d44ec5c2506995fbad75320acbae49125d3d/core/dbt/cli/resolvers.py#L6
54-
def default_project_dir() -> Path:
55-
paths = list(Path.cwd().parents)
56-
paths.insert(0, Path.cwd())
57-
return next((x for x in paths if (x / PROJECT_FILE).exists()), Path.cwd())
58-
59-
60-
# https://github.com/dbt-labs/dbt-core/blob/c952d44ec5c2506995fbad75320acbae49125d3d/core/dbt/cli/resolvers.py#L12
61-
def default_profiles_dir() -> Path:
62-
return Path.cwd() if (Path.cwd() / PROFILES_FILE).exists() else Path.home() / ".dbt"
63-
64-
65-
def legacy_profiles_dir() -> Path:
66-
return Path.home() / ".dbt"
67-
6845

6946
@dataclass
7047
class DiffVars:

tests/test_dbt.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@
1111
_local_diff,
1212
_cloud_diff,
1313
DbtParser,
14-
RUN_RESULTS_PATH,
15-
MANIFEST_PATH,
16-
PROJECT_FILE,
1714
DiffVars,
1815
DatafoldAPI,
1916
)
17+
from data_diff.dbt_parser import (
18+
RUN_RESULTS_PATH,
19+
PROJECT_FILE,
20+
)
2021
import unittest
2122
from unittest.mock import MagicMock, Mock, mock_open, patch, ANY
2223

0 commit comments

Comments
 (0)