You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we were working on CSV Schema Language we found it necessary to allow uniqueness to be defined over a composite set of columns (the unique column rule in the schema). I can see from the code structure that this wouldn't necessarily be entirely straightforward here, but I think it would be useful.
I must admit that I was forgetting that our CSVs do typically have a URI per row too which is unique, so we could use that for purposes of getting a diff. May still be useful for others though.
For human_text(), perhaps some way of passing in a formatting string? In Python terms we'd want something likef"{r['lettercode']} {r['series']}/{r['piece']}/{r['item']} image {r['ordinal']}"
Seconding this, I'd find this very useful. As best as I can find, there are no other similar libraries that allow for composite keys, but I already use and am very happy with this package.
Components stay separate: A|B + C differs from A + B|C. Rows with any blank component go to review. If a complete combination is duplicated in either input, all its rows on both sides go to review. Optional value comparisons use only unique shared combinations.
The bundled warehouse inputs and generated reports exercise this: five unique shared combinations, five review rows across the two inputs, and three changed cells.
This is a separate MIT-licensed tool with its own CSV report files and manifest. I publish it from this account; implementation and verification were AI-led.
Activity
simonw commentedon Apr 7, 2019
This doesn't seem impossibly difficult to add... it could work by allowing users to specify the
--keyoption multiple timesPart of the work would be teaching the CSV loading function to work with compound keys and create the internal ID as a tuple of values:
csv-diff/csv_diff/__init__.py
Lines 10 to 15 in 825a28c
The
human_text()function would then need to learn how to display a compound ID.DavidUnderdown commentedon Apr 8, 2019
Thanks Simon,
I must admit that I was forgetting that our CSVs do typically have a URI per row too which is unique, so we could use that for purposes of getting a diff. May still be useful for others though.
For
human_text(), perhaps some way of passing in a formatting string? In Python terms we'd want something likef"{r['lettercode']} {r['series']}/{r['piece']}/{r['item']} image {r['ordinal']}"maxwelllc commentedon Oct 6, 2020
Seconding this, I'd find this very useful. As best as I can find, there are no other similar libraries that allow for composite keys, but I already use and am very happy with this package.
puddleoasis commentedon Aug 16, 2023
Hi @simonw I've made progress on this feature and would like to share. Would you grant me write access?
patric-r commentedon Aug 16, 2023
@puddleoasis why not submit a PR?
jhrch7 commentedon Nov 3, 2026
For the command-line use case, Local Row Check 1.3.0 supports repeating the key option:
Components stay separate:
A|B+Cdiffers fromA+B|C. Rows with any blank component go to review. If a complete combination is duplicated in either input, all its rows on both sides go to review. Optional value comparisons use only unique shared combinations.The bundled warehouse inputs and generated reports exercise this: five unique shared combinations, five review rows across the two inputs, and three changed cells.
This is a separate MIT-licensed tool with its own CSV report files and manifest. I publish it from this account; implementation and verification were AI-led.