Repository navigation
Test Excel workbooks with format: xlsx - #1720
Open
nicolehazel wants to merge 7 commits into
Open
nicolehazel wants to merge 7 commits into
nicolehazel wants to merge 7 commits into
Conversation
Read each sheet through DuckDB's excel extension, one sheet per schema named by its physicalName. The sheet is read typed and as text, lined up row by row, so Excel dates arrive as dates and a cell of the wrong type fails its column's type check. Closes datacontract#1717 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
nicolehazel
marked this pull request as ready for review
October 10, 2026 20:26
Resolve conflicts with datacontract#1719 (per-path nested type checks) and the v1.2.5/v1.2.6 releases: keep the xlsx type check ahead of the new own_type block, take the new schema.md paragraph, and move the changelog entry to Unreleased. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The error for models that share a workbook without a physicalName now says "The model(s) ...", so it no longer reads as plural when only one model is missing its sheet name.
The installation table now labels the excel extra as import/export, next to xlsx for testing, and the Excel workbooks section notes that a sheet is cropped at its first empty header column.
jschoedl
reviewed
Oct 16, 2026
jschoedl
left a comment
Collaborator
There was a problem hiding this comment.
Hi, thank you for the PR. One small suggestion, apart from that LGTM!
| """ | ||
| sheet = schema_obj.physicalName | ||
| view = sheet or schema_obj.name | ||
| options = f"'{_sql_literal(model_path)}', header=true" |
Collaborator
There was a problem hiding this comment.
read_xlsx stops at the first empty row by default, so rows below a blank spacer row are never checked and the test still passes.
Could you pass stop_at_empty=false and skip the rows that are empty in every column? I think this should not be a big change, but would avoid confusion if a part of the table is silently thrown away
Author
There was a problem hiding this comment.
Thanks for the feedback!
Done in 173910c:
- sheet is read with
stop_at_empty=false, rows that are empty in every column are skipped test_rows_below_an_empty_row_are_checkedputs a blank row in the middle of the sheet and a wrong-typed value below it
Keep the xlsx changelog entry under Unreleased, above the v1.2.7 release. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
read_xlsx stops at the first empty row by default, so rows below a blank spacer row went unchecked. Read the whole sheet and skip the rows that are empty in every column. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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 #1717
Adds
format: xlsxtodatacontract test, read through DuckDB's excel extension, with one sheet per schema named by itsphysicalName.Each sheet is read twice and the reads are lined up row by row: once typed, so Excel dates (numbers with a date format) arrive as dates, and once as text, so a cell of the wrong type is still seen. A type check per column counts the cells that have a value but not the contract's type.
Possible follow-up: show the offending cells under
--include-failed-samples, which today samples only missing, invalid and duplicate counts.uv run pytest)uv run ruff check --fix && uv run ruff format)Co-authored by a human (@nicolehazel) and Claude Code.