Open jeffix2000 opened 1 month ago
Thanks for the report! I can reproduce.
To add some details, this seems to do with treating empty values from a CSV as NULL
values (rather than blanks). That is visible if you add a formula like type($A)
-- if column A has a blank string value, that formula would return <class 'str'>
; if it has a NULL
(or None
in Python), it would return <class 'NoneType'>
. Storing nulls into a text column seems wrong, that may be a bug. For other columns (numbers, dates), it is correct.
The issue with matching comes from this because of SQL behavior that NULL
is not considered to be equal to NULL
. A potential way around it would be to construct the query as something like LEFT JOIN b ON a.field = b.field OR (a.field IS NULL AND b.field IS NULL)
.
Describe the current behavior
When trying to update an existing table from a CSV file, blank values in the file are ignored so that, in case of a record update, existing values of the record are not erased by the update (making the update capability incremental in both dimensions) - as per the doc https://support.getgrist.com/imports/#updating-existing-records.
But blank values seem to be ignored even for those columns selected as "matching fields" for merging with existing records of the target table. In that situation, the imported line in wrongly interpreted as a new record and added to the table.
Steps to reproduce
label
text, some randomproperty
number or text, and atrace
attribute (e.g. the line $id, to be converted to static data before the import).label
&property
as the matching condition.Expected: the test record should be updated with the imported
trace
value.Observed: the imported line is added as a brand new record.
Bonus:
Describe the expected behavior
Ignoring blank values for imported lines should be applied except for defined "matching fields".
An imported line with blank values in matching fields should match an existing record with the same values in matching field, including the blank ones (in this case, blank should be a positive information == None).
An imported line with blank values in non-matching fields should add or update an existing record without tampering with the occasional existing values in those fields, as is already the case.
Where have you encountered this bug?
Instance information (when self-hosting only)
Sample table to reproduce : https://docs.getgrist.com/fvzX9oY6ki8e/Test-structures/p/1.
Browser: Firefox 115.14.0esr.