feat: add datacompy compare CLI with multi-backend support - #544
Merged
Conversation
rhaffar
reviewed
Aug 5, 2026
rhaffar
left a comment
Contributor
There was a problem hiding this comment.
Looks good Faisal, just a few comments - thanks for incorporating some of the changes I recommended from the last PR
Comment on lines
+107
to
+113
| if join_columns and on_index: | ||
| raise BadArgsError("--on and --on-index are mutually exclusive.") | ||
| if not join_columns and not on_index: | ||
| raise BadArgsError( | ||
| "--on is required. Specify at least one join column with --on COL, " | ||
| "or use --on-index with --backend pandas to join on the index." | ||
| ) |
Contributor
There was a problem hiding this comment.
We do check for this in the Pandas compare code - wondering if we should just passthrough both args and let the compare throw the error instead?
Member
Author
There was a problem hiding this comment.
I think we should catch it in the CLI process since its separate from the non-CLI part of datacompy. Open to changing it if you think otherwise!
Contributor
There was a problem hiding this comment.
Makes sense, this one is more of a personal preference thing so more than ok to catch it in the CLI 👍
Member
Author
|
Thanks Raymond:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #530, Using this one in favour of #534
Adds a
datacompyconsole script so two datasets can be compared from a shell without writing a throwaway script, for ad hoc checks and for CI pipelines that run as shell tasks.Exit codes: 0 match, 1 mismatch or threshold exceeded, 2 error, 130 interrupt.
Supports the pandas, polars, Spark, and Snowflake backends over CSV, Parquet, and JSON.
Design notes:
parser.pyholds one declarativeOPTIONStable that drives both theargparseparser and theCompareconstructorkwargs. Adding a library keyword to the CLI is a single new row rather than two hand-maintained lists, andtests/cli/test_parser.pychecks every mapping against the real constructor signature via inspect.signature, so the two cannot silently drift.--on-indexbeing pandas only and--cast-column-names-lowernot applying to Snowflake, is data on the spec row rather than a validation branch.backends.pydefines aCLIBackendABC mirroring the existingBaseComparestrategy pattern. Each backend owns its session, loaders, and constructor