CSV validation: column headings foo.bar and foo.baz cause column to go missing #11990
Labels
status: accepted
This issue has been accepted for implementation
type: bug
A confirmed report of unexpected behavior in the application
NetBox version
v3.4.6
Python version
3.8
Steps to Reproduce
Go to
/ipam/ip-addresses/import/
(IPAM > IP Addresses > upload)Paste in the following data into the text area:
Click Submit.
(Example taken from discussion #11988)
Expected Behavior
Successful upload, or a meaningful error response.
Observed Behavior
The data is rejected with the following error:
The error message suggests that the submitter only included four column headings, which is incorrect.
Analysis
Ref: Discussion link.
Looking at test cases for CSV upload, I see this example:
I am guessing that if there's a column "foo.bar" and another column "foo.baz", the second column overwrites the dict key "foo" in this structure.
Resolution
The simplest resolution would be to detect duplicate/overlapping column names, and report them as such. (e.g. "Column 'foo.baz' conflicts with column 'foo.bar'")
This would also capture the simpler case:
(also wrongly reported as "Expected 2 columns but found 3")
A longer-term resolution would be to support the use case which the original poster wanted, which was to be able to refer to a related object via more than one attribute, as had been originally proposed here when CSV upload was reworked for v2.8.2. I think that would be a substantial change.
The text was updated successfully, but these errors were encountered: