Skip to content

v2: check for missing required columns when loading tables - #610

Open
dweindl wants to merge 2 commits into
PEtab-dev:mainfrom
dweindl:v2-missing-columns
Open

dweindl wants to merge 2 commits into
PEtab-dev:mainfrom
dweindl:v2-missing-columns

Conversation

@dweindl

@dweindl dweindl commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Creating v2 tables via from_df / from_tsv (including the Problem.*_df setters) now raises petab.v2.MissingColumnsError if required columns are missing. The message names the table, the missing columns, and the file, e.g., ParameterTable is missing required column(s): estimate. File: .../parameters.tsv. petablint reports this without a traceback.

Previously, missing columns resulted in pydantic errors per row, a bare KeyError (experiment table), or were silently accepted (a missing estimate column defaulted to true, a missing experimentId column to empty experiment IDs).

BaseTable.from_df now handles None/column-less input, moves named index levels to columns, and checks required columns before delegating to the new abstract _from_df. As a side effect, condition and experiment tables now accept their ID column as index, like the other tables. The sciml HybridizationTable gets the same check.

Relates to #369.

🤖 This pull request was created by an AI agent (Claude Code).

🤖 Generated with Claude Code

@codecov-commenter

codecov-commenter commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.85714% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.31%. Comparing base (d21ee3b) to head (b188bb3).

Files with missing lines Patch % Lines
petab/petablint.py 0.00% 4 Missing ⚠️
petab/v2/core.py 93.10% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #610      +/-   ##
==========================================
+ Coverage   80.18%   80.31%   +0.13%     
==========================================
  Files          70       70              
  Lines        8442     8454      +12     
  Branches     1544     1543       -1     
==========================================
+ Hits         6769     6790      +21     
+ Misses       1182     1177       -5     
+ Partials      491      487       -4     

☔ 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.

@dweindl
dweindl marked this pull request as ready for review November 18, 2026 09:44
@dweindl
dweindl requested a review from a team as a code owner November 18, 2026 09:44
@dweindl dweindl self-assigned this Nov 18, 2026
dweindl and others added 2 commits November 18, 2026 13:53
Creating v2 tables from DataFrames or TSV files now raises
`MissingColumnsError` if required columns are missing, naming the table,
the missing columns, and the file. Previously, this resulted in
unspecific pydantic errors or `KeyError`s, or was silently accepted
(e.g., a missing `estimate` column defaulted to `True`). `petablint`
reports this error without a traceback.

`BaseTable.from_df` now handles `None`/empty input, moves named index
levels to columns, and checks required columns before delegating to the
new abstract `_from_df`. The sciml `HybridizationTable` gets the same
check.

Relates to PEtab-dev#369.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

2 participants