Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mwalker opened this issue Nov 19, 2024 · 0 comments
Open

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

mwalker opened this issue Nov 19, 2024 · 0 comments

Comments

@mwalker
Copy link

mwalker commented Nov 19, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant