Skip to content

feat: add programmatic Report API with structured comparison data#532

Merged
fdosani merged 23 commits into
capitalone:mainfrom
capitalone-contributions:datacompy-arrow-datasets
Jun 19, 2026
Merged

feat: add programmatic Report API with structured comparison data#532
fdosani merged 23 commits into
capitalone:mainfrom
capitalone-contributions:datacompy-arrow-datasets

Conversation

@fdosani

@fdosani fdosani commented Jun 18, 2026

Copy link
Copy Markdown
Member

Closes #531

  • Introduces a new ReportData dataclass in datacompy/report.py that exposes structured comparison results (mismatches, unmatched rows, column stats) as a programmatic API, accessible via a new .report property on all compare classes
  • Consolidates report generation logic into datacompy/base.py, removing duplicated summary methods from pandas.py, polars.py, snowflake.py, and spark.py
  • Adds snapshot regression tests for Pandas and Polars report output to catch unintended formatting changes
  • Adds docs/source/report_api.rst documenting the new API and updates the template guide.

fdosani added 15 commits June 16, 2026 22:12
@fdosani

fdosani commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

@ak-gupta @rhaffar worth having more of a discussion on this one, as its a bit involved on the backend.

@rhaffar rhaffar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the centralizing of our reporting logic here - it's so similar between the different backends, I think keeping that intent in one spot makes more sense than re-implementing it for each backend. No real gripes from me here on any of these changes - just a few small comments.

Comment thread datacompy/polars.py
@@ -703,246 +700,6 @@ def all_mismatch(self, ignore_matching_cols: bool = False) -> pl.DataFrame:
.select(self.join_columns + return_list)
)

@rhaffar rhaffar Jun 19, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing the polars compare doesn't implement _select_first_n_columns and _column_names since it's using the default implementation? If all the other compare classes have to overwrite it anyways, might opt to just make the base class method abstract and force all compare classes to implement them.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd like to leave this as is for now. Maybe we can have an offline discussion about this? Just want to avoid duplication here as much as possible.

Comment thread datacompy/base.py Outdated
@fdosani fdosani requested a review from rhaffar June 19, 2026 18:17

@rhaffar rhaffar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fdosani fdosani merged commit 6eb910f into capitalone:main Jun 19, 2026
20 checks passed
@spork-prod spork-prod Bot deleted the datacompy-arrow-datasets branch June 19, 2026 18:48
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

Successfully merging this pull request may close these issues.

feat: modular reporting framework

2 participants