From 0acd9fa8f3f4ed46b8796fbc96a2621c0db69f43 Mon Sep 17 00:00:00 2001 From: Mingye Wang Date: Thu, 29 Jan 2026 16:29:46 +0800 Subject: [PATCH 1/2] CSV: provide column number and just the relevant cell on error Fix #417 --- src/core/parsers/csv.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/parsers/csv.py b/src/core/parsers/csv.py index 710ae0a9..64697856 100644 --- a/src/core/parsers/csv.py +++ b/src/core/parsers/csv.py @@ -41,6 +41,7 @@ def parse_line(self, row, header): for index, cell in enumerate(row): cell_value = cell.strip() + debuginfo = f"Column {index}: {cell_value}" current_value = self.parse_value(cell_value) if current_value is None: current_value = {"type": "string", "value": cell_value} @@ -146,7 +147,7 @@ def parse_line(self, row, header): current_command["value"]["value"] ] - commands.append(current_command) + commands.append((debuginfo, current_command)) return commands @@ -194,7 +195,7 @@ def parse(self, raw_csv) -> Iterator[BatchCommand]: first_line = False else: commands = self.parse_line(row, header) - for command in commands: + for debuginfo, command in commands: action = BatchCommand.ACTION_CREATE operation = None if command["action"] == "add": @@ -221,7 +222,7 @@ def parse(self, raw_csv) -> Iterator[BatchCommand]: yield BatchCommand( index=index, json=command, - raw=row, + raw=debuginfo, action=action, operation=operation, status=BatchCommand.STATUS_INITIAL, From 98ecc1a4ea78aa1235a22e3c1c84a50bd8228c6c Mon Sep 17 00:00:00 2001 From: Mingye Wang Date: Fri, 30 Jan 2026 11:48:19 +0800 Subject: [PATCH 2/2] Enhance debug information in CSV parser Updated debuginfo to include header information. --- src/core/parsers/csv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/parsers/csv.py b/src/core/parsers/csv.py index 64697856..b538fae3 100644 --- a/src/core/parsers/csv.py +++ b/src/core/parsers/csv.py @@ -41,12 +41,12 @@ def parse_line(self, row, header): for index, cell in enumerate(row): cell_value = cell.strip() - debuginfo = f"Column {index}: {cell_value}" current_value = self.parse_value(cell_value) if current_value is None: current_value = {"type": "string", "value": cell_value} header_value = header[index] # HEADER VALUE + debuginfo = f"header[{index}]={header[index]!r}\n{cell_value=}," if index == 0: # That is the QID, alway in the firs column if not cell_value: