Skip to content

Error when column name contains ".." (two dots) #40

Description

@mwalker

I believe this is similar to #7, in that it is related to the text of column names, or in this case the key names in JSON. If they have ".." in the name of the key, like "name..date_range": then I get an error like:

Taggerty:prov-api-harvester mwalker$ uv run --with csv-diff csv-diff --format=json --key=citation "a.json" "b.json"
Traceback (most recent call last):
  File "/Users/mwalker/.cache/uv/archive-v0/PsALVJ9vZC43tN78TBpb-/bin/csv-diff", line 10, in <module>
    sys.exit(cli())
             ~~~^^
  File "/Users/mwalker/.cache/uv/archive-v0/PsALVJ9vZC43tN78TBpb-/lib/python3.13/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/mwalker/.cache/uv/archive-v0/PsALVJ9vZC43tN78TBpb-/lib/python3.13/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/mwalker/.cache/uv/archive-v0/PsALVJ9vZC43tN78TBpb-/lib/python3.13/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mwalker/.cache/uv/archive-v0/PsALVJ9vZC43tN78TBpb-/lib/python3.13/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/mwalker/.cache/uv/archive-v0/PsALVJ9vZC43tN78TBpb-/lib/python3.13/site-packages/csv_diff/cli.py", line 76, in cli
    diff = compare(previous_data, current_data, show_unchanged)
  File "/Users/mwalker/.cache/uv/archive-v0/PsALVJ9vZC43tN78TBpb-/lib/python3.13/site-packages/csv_diff/__init__.py", line 98, in compare
    for _, field, (prev_value, current_value) in diffs
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: not enough values to unpack (expected 2, got 1)

Sample JSON files:
a.json

[
  {
    "_id": "F6E388C2-F1A7-11E9-AE98-B368FE166A06",
    "category": "Agency",
    "citation": "VA 421",
    "name.date_range": null,
    "name.aka.date_range": null,
    "name.official_title.date_range": "[1979 TO 1992]",
    "status": "Published",
    "timestamp": 1614747820,
    "title": "Ministry for Police and Emergency Services"
  }
]

b.json

[
  {
    "_id": "F6E388C2-F1A7-11E9-AE98-B368FE166A06",
    "category": "Agency",
    "citation": "VA 421",
    "name..date_range": null,
    "name.aka.date_range": null,
    "name.official_title.date_range": "[1979 TO 1993]",
    "status": "Published",
    "timestamp": 1614787820,
    "title": "Ministry for Police and Emergency Services"
  }
]

My quick attempts to resolve it so far have not been successful. Thanks for a great tool!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions