From 38d5986ea1a2a85353b88a83e0ba8288c7fc5a13 Mon Sep 17 00:00:00 2001 From: Erez Shinan Date: Tue, 9 Aug 2022 18:04:51 +0200 Subject: [PATCH 1/2] Bugfix for mutual columns feature (6a4c4438537) --- data_diff/databases/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data_diff/databases/base.py b/data_diff/databases/base.py index e276e93d..f877ba2f 100644 --- a/data_diff/databases/base.py +++ b/data_diff/databases/base.py @@ -192,7 +192,7 @@ def query_table_schema(self, path: DbPath) -> Dict[str, tuple]: def _process_table_schema(self, path: DbPath, raw_schema: Dict[str, tuple], filter_columns: Sequence[str]): accept = {i.lower() for i in filter_columns} - col_dict = {name: self._parse_type(path, *row) for name, row in raw_schema.items() if name.lower() in accept} + col_dict = {row[0]: self._parse_type(path, *row) for name, row in raw_schema.items() if name.lower() in accept} self._refine_coltypes(path, col_dict) From a61961ec0bc912eacf4e09541de9deea8a64e043 Mon Sep 17 00:00:00 2001 From: Erez Shinan Date: Tue, 9 Aug 2022 18:21:04 +0200 Subject: [PATCH 2/2] Better error messages --- data_diff/diff_tables.py | 6 +++--- data_diff/utils.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/data_diff/diff_tables.py b/data_diff/diff_tables.py index 7ea894da..97bb3193 100644 --- a/data_diff/diff_tables.py +++ b/data_diff/diff_tables.py @@ -85,13 +85,13 @@ class TableSegment: def __post_init__(self): if not self.update_column and (self.min_update or self.max_update): - raise ValueError("Error: min_update/max_update feature requires to specify 'update_column'") + raise ValueError("Error: the min_update/max_update feature requires 'update_column' to be set.") if self.min_key is not None and self.max_key is not None and self.min_key >= self.max_key: - raise ValueError("Error: min_key expected to be smaller than max_key!") + raise ValueError(f"Error: min_key expected to be smaller than max_key! ({self.min_key} >= {self.max_key})") if self.min_update is not None and self.max_update is not None and self.min_update >= self.max_update: - raise ValueError("Error: min_update expected to be smaller than max_update!") + raise ValueError(f"Error: min_update expected to be smaller than max_update! ({self.min_update} >= {self.max_update})") @property def _update_column(self): diff --git a/data_diff/utils.py b/data_diff/utils.py index 27391e0f..e0cb32fa 100644 --- a/data_diff/utils.py +++ b/data_diff/utils.py @@ -18,6 +18,7 @@ def safezip(*args): def split_space(start, end, count): size = end - start + assert count <= size, (count, size) return list(range(start, end, (size + 1) // (count + 1)))[1 : count + 1]