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

Commit 4c311cf

Browse files
authored
Merge pull request #517 from dlawin/issue_516
warn when using recent dbt-core version
2 parents bbb406f + 46f3371 commit 4c311cf

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

data_diff/dbt_parser.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def import_dbt():
2828
PROJECT_FILE = "dbt_project.yml"
2929
PROFILES_FILE = "profiles.yml"
3030
LOWER_DBT_V = "1.0.0"
31-
UPPER_DBT_V = "1.4.6"
31+
UPPER_DBT_V = "1.4.7"
3232

3333

3434
# https://github.com/dbt-labs/dbt-core/blob/c952d44ec5c2506995fbad75320acbae49125d3d/core/dbt/cli/resolvers.py#L6
@@ -76,10 +76,12 @@ def get_models(self):
7676
if dbt_version < parse_version("1.3.0"):
7777
self.profiles_dir = legacy_profiles_dir()
7878

79-
if dbt_version < parse_version(LOWER_DBT_V) or dbt_version >= parse_version(UPPER_DBT_V):
79+
if dbt_version < parse_version(LOWER_DBT_V):
8080
raise Exception(
81-
f"Found dbt: v{dbt_version} Expected the dbt project's version to be >= {LOWER_DBT_V} and < {UPPER_DBT_V}"
81+
f"Found dbt: v{dbt_version} Expected the dbt project's version to be >= {LOWER_DBT_V}"
8282
)
83+
elif dbt_version >= parse_version(UPPER_DBT_V):
84+
logger.warning(f"{dbt_version} is a recent version of dbt and may not be fully tested with data-diff! \nPlease report any issues to https://github.com/datafold/data-diff/issues")
8385

8486
success_models = [x.unique_id for x in run_results_obj.results if x.status.name == "success"]
8587
models = [self.manifest_obj.nodes.get(x) for x in success_models]

tests/test_dbt.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,22 +89,6 @@ def test_get_models_bad_lower_dbt_version(self, mock_open):
8989
mock_self.parse_manifest.assert_not_called()
9090
self.assertIn("version to be", ex.exception.args[0])
9191

92-
@patch("builtins.open", new_callable=mock_open, read_data="{}")
93-
def test_get_models_bad_upper_dbt_version(self, mock_open):
94-
mock_self = Mock()
95-
mock_self.project_dir = Path()
96-
mock_run_results = Mock()
97-
mock_self.parse_run_results.return_value = mock_run_results
98-
mock_run_results.metadata.dbt_version = "1.5.1"
99-
100-
with self.assertRaises(Exception) as ex:
101-
DbtParser.get_models(mock_self)
102-
103-
mock_open.assert_called_once_with(Path(RUN_RESULTS_PATH))
104-
mock_self.parse_run_results.assert_called_once_with(run_results={})
105-
mock_self.parse_manifest.assert_not_called()
106-
self.assertIn("version to be", ex.exception.args[0])
107-
10892
@patch("builtins.open", new_callable=mock_open, read_data="{}")
10993
def test_get_models_no_success(self, mock_open):
11094
mock_self = Mock()

0 commit comments

Comments
 (0)