From 17d0e4239f6cb1d5c3820730162b3f59d83dac68 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 24 Feb 2022 09:08:12 +0300 Subject: Store columns in the output dict When inserting, deleting, or editing case-attributes, we need the column headers in order to be able to know identify the attribute of interest. * gn3/csvcmp.py (csv_diff): Add extra "Column" key in returned dict. --- gn3/csvcmp.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gn3/csvcmp.py b/gn3/csvcmp.py index e033396..a525b91 100644 --- a/gn3/csvcmp.py +++ b/gn3/csvcmp.py @@ -59,7 +59,10 @@ def csv_diff(base_csv, delta_csv, tmp_dir="/tmp"): f"'{file_name1}' '{file_name2}' " "--format json")) if _r.get("code") == 0: - _r["output"] = json.loads(_r.get("output")) + _r = json.loads(_r.get("output")) + _r["Columns"] = max(_header1, _header2) + else: + _r = {} # Clean Up! if os.path.exists(file_name1): os.remove(file_name1) -- cgit v1.2.3