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

reverse order of dev and prod tables in cli printout and cloud diffs #389

Merged
merged 2 commits into from
Feb 14, 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
28 changes: 14 additions & 14 deletions data_diff/dbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def dbt_diff(
elif is_cloud:
rich.print(
"[red]"
+ ".".join(diff_vars.dev_path)
+ " <> "
+ ".".join(diff_vars.prod_path)
+ " <> "
+ ".".join(diff_vars.dev_path)
+ "[/] \n"
+ "Skipped due to missing primary-key tag\n"
)
Expand All @@ -77,9 +77,9 @@ def dbt_diff(
elif not is_cloud:
rich.print(
"[red]"
+ ".".join(diff_vars.dev_path)
+ " <> "
+ ".".join(diff_vars.prod_path)
+ " <> "
+ ".".join(diff_vars.dev_path)
+ "[/] \n"
+ "Skipped due to missing primary-key tag or multi-column primary-key (unsupported for non --cloud diffs)\n"
)
Expand Down Expand Up @@ -129,9 +129,9 @@ def _local_diff(diff_vars: DiffVars) -> None:
logging.info(ex)
rich.print(
"[red]"
+ dev_qualified_string
+ " <> "
+ prod_qualified_string
+ " <> "
+ dev_qualified_string
+ "[/] \n"
+ column_diffs_str
+ "[green]New model or no access to prod table.[/] \n"
Expand All @@ -156,9 +156,9 @@ def _local_diff(diff_vars: DiffVars) -> None:
if list(diff):
rich.print(
"[red]"
+ dev_qualified_string
+ " <> "
+ prod_qualified_string
+ " <> "
+ dev_qualified_string
+ "[/] \n"
+ column_diffs_str
+ diff.get_stats_string(is_dbt=True)
Expand All @@ -167,9 +167,9 @@ def _local_diff(diff_vars: DiffVars) -> None:
else:
rich.print(
"[red]"
+ dev_qualified_string
+ " <> "
+ prod_qualified_string
+ " <> "
+ dev_qualified_string
+ "[/] \n"
+ column_diffs_str
+ "[green]No row differences[/] \n"
Expand All @@ -191,8 +191,8 @@ def _cloud_diff(diff_vars: DiffVars) -> None:
payload = {
"data_source1_id": diff_vars.datasource_id,
"data_source2_id": diff_vars.datasource_id,
"table1": diff_vars.dev_path,
"table2": diff_vars.prod_path,
"table1": diff_vars.prod_path,
"table2": diff_vars.dev_path,
"pk_columns": diff_vars.primary_keys,
}

Expand All @@ -216,9 +216,9 @@ def _cloud_diff(diff_vars: DiffVars) -> None:
diff_url = f"https://app.datafold.com/datadiffs/{diff_id}/overview"
rich.print(
"[red]"
+ ".".join(diff_vars.dev_path)
+ " <> "
+ ".".join(diff_vars.prod_path)
+ " <> "
+ ".".join(diff_vars.dev_path)
+ "[/] \n Diff in progress: \n "
+ diff_url
+ "\n"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_dbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ def test_cloud_diff(self, mock_request, mock_os_environ, mock_print):
)
self.assertEqual(request_data_dict["data_source1_id"], expected_datasource_id)
self.assertEqual(request_data_dict["data_source2_id"], expected_datasource_id)
self.assertEqual(request_data_dict["table1"], dev_qualified_list)
self.assertEqual(request_data_dict["table2"], prod_qualified_list)
self.assertEqual(request_data_dict["table1"], prod_qualified_list)
self.assertEqual(request_data_dict["table2"], dev_qualified_list)
self.assertEqual(request_data_dict["pk_columns"], expected_primary_keys)

@patch("data_diff.dbt.rich.print")
Expand Down