From e2a7e51b028edfc4ee1f4ae5dfff28caf60f19b0 Mon Sep 17 00:00:00 2001 From: "Wei-Chun, Chang" Date: Tue, 7 May 2024 18:19:40 +0800 Subject: [PATCH] Support to parse query diff with joins result doing recce summary Signed-off-by: Wei-Chun, Chang --- recce/tasks/query.py | 16 +++++++++++++++- setup.py | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/recce/tasks/query.py b/recce/tasks/query.py index 3b99ad1f..cbbda4ab 100644 --- a/recce/tasks/query.py +++ b/recce/tasks/query.py @@ -233,5 +233,19 @@ class QueryDiffResultDiffer(TaskResultDiffer): def _check_result_changed_fn(self, result): base = result.get('base') current = result.get('current') + diff = result.get('diff') - return TaskResultDiffer.diff(base, current) + if diff is None: + return TaskResultDiffer.diff(base, current) + else: + base = dict(columns=[], data=[]) + current = dict(columns=[], data=[]) + base['columns'] = diff['columns'][:-2] + current['columns'] = diff['columns'][:-2] + + for data in diff['data']: + if data[-2] is True: + base['data'].append(data[:-2]) + elif data[-1] is True: + current['data'].append(data[:-2]) + return TaskResultDiffer.diff(base, current) diff --git a/setup.py b/setup.py index 273815aa..1b35c574 100644 --- a/setup.py +++ b/setup.py @@ -29,6 +29,7 @@ def _get_version(): 'ruamel.yaml<0.18.0', 'click>=7.1', 'dbt-core>=1.5', + 'deepdiff', 'portalocker', 'fastapi', 'itsdangerous',