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

Commit d1afc17

Browse files
committed
include only rows with equal PK to values diff stats in --json output
1 parent 63598f4 commit d1afc17

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

data_diff/diff_tables.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ def get_stats_string(self, is_dbt: bool = False):
165165

166166
return string_output
167167

168-
def get_stats_dict(self):
169-
diff_stats = self._get_stats()
168+
def get_stats_dict(self, is_dbt: bool = False):
169+
diff_stats = self._get_stats(is_dbt)
170170
json_output = {
171171
"rows_A": diff_stats.table1_count,
172172
"rows_B": diff_stats.table2_count,
@@ -177,6 +177,8 @@ def get_stats_dict(self):
177177
"total": sum(diff_stats.diff_by_sign.values()),
178178
"stats": self.stats,
179179
}
180+
if diff_stats.extra_column_diffs:
181+
json_output["values"] = diff_stats.extra_column_diffs
180182

181183
return json_output
182184

data_diff/format.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def jsonify(
5151

5252
summary = None
5353
if with_summary:
54-
summary = _jsonify_diff_summary(diff.get_stats_dict())
54+
summary = _jsonify_diff_summary(diff.get_stats_dict(is_dbt=True))
5555

5656
columns = None
5757
if with_columns:
@@ -258,7 +258,7 @@ def _jsonify_diff_summary(stats_dict: dict) -> JsonDiffSummary:
258258
updated=stats_dict["updated"],
259259
unchanged=stats_dict["unchanged"],
260260
),
261-
stats=Stats(diffCounts=stats_dict["stats"]["diff_counts"]),
261+
stats=Stats(diffCounts=stats_dict["values"]),
262262
)
263263

264264

0 commit comments

Comments
 (0)