feat: implement effective CSV delimiter resolution for imports
- Added `resolve_effective_csv_delimiter` function to determine the correct delimiter based on the uploaded file and template. - Updated CSV import logic to utilize the new delimiter resolution method, ensuring accurate parsing of CSV files with varying delimiters. - Enhanced documentation to reflect changes in delimiter handling. - Added unit tests for the new delimiter resolution functionality.
This commit is contained in:
1 parent
0ad3ddd627
commit
7226e04e9c
5 files changed
+63
-3
No files matched your search
@@ -11,7 +11,7 @@ from typing import Any
|
||||
|
||||
import logging
|
||||
|
||||
from csv_parser.core import iter_csv_dict_rows
|
||||
from csv_parser.core import iter_csv_dict_rows, resolve_effective_csv_delimiter
|
||||
from csv_parser.import_row_processing import (
|
||||
aggregate_mapped_rows,
|
||||
resolve_import_row_processing,
|
||||
@@ -97,7 +97,8 @@ def run_universal_csv_import(
|
||||
if tc is not None and not isinstance(tc, dict):
|
||||
tc = None
|
||||
|
||||
delim = mapping.get("delimiter") or ","
|
||||
tpl_delim = str(mapping.get("delimiter") or ",").strip() or ","
|
||||
delim = resolve_effective_csv_delimiter(text, tpl_delim)
|
||||
has_header = mapping.get("has_header", True)
|
||||
|
||||
if module == "nutrition":
|
||||
|
||||
Reference in new issue
Block a user