Skip to content

chore: Raise on primary key dtype mimsatch - #56

Merged
Marius Merkle (MariusMerkleQC) merged 2 commits into
mainfrom
pk_dtype_mismatch
Aug 31, 2026
Merged

chore: Raise on primary key dtype mimsatch#56
Marius Merkle (MariusMerkleQC) merged 2 commits into
mainfrom
pk_dtype_mismatch

Conversation

@MariusMerkleQC

@MariusMerkleQC Marius Merkle (MariusMerkleQC) commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Solves #52.

Changes

Instead of silently ignoring an invalid primary key (e.g. due to data type mismatch), I suggest raising a PrimaryKeyError as we do for other instances where the passed primary_key is in fact not a valid primary key.

@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (3bbdce9) to head (aa4131a).

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #56   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines         1140      1138    -2     
=========================================
- Hits          1140      1138    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI 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.

🟢 Approval recommended

Pull request overview

This PR changes Diffly’s primary-key validation behavior to fail fast when the left/right primary key column dtypes are incompatible, instead of warning and silently disabling the primary key. This makes dtype mismatches explicit and prevents comparisons from continuing in an unintended “no primary key” mode.

Changes:

  • Replace the previous UserWarning + primary_key = None fallback with raising PrimaryKeyError when join-key dtypes are incompatible.
  • Update the corresponding unit test to assert the new exception-based behavior.
File summaries
File Description
diffly/comparison.py Converts primary key dtype incompatibility handling from a warning-and-fallback to raising PrimaryKeyError.
tests/test_dataframe_comparison.py Updates the dtype-mismatch test to expect PrimaryKeyError instead of a warning.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@MariusMerkleQC
Marius Merkle (MariusMerkleQC) merged commit 5f0a9e9 into main Aug 31, 2026
18 checks passed
@MariusMerkleQC
Marius Merkle (MariusMerkleQC) deleted the pk_dtype_mismatch branch August 31, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Confusing error messages for primary key dtype mismatch

3 participants