Fix TypeError in vacuum_lakehouse_tables() when retain_n_hours is None - #1325
Draft
Michael Kovalsky (m-kovalsky) with Copilot wants to merge 2 commits into
Draft
Fix TypeError in vacuum_lakehouse_tables() when retain_n_hours is None#1325Michael Kovalsky (m-kovalsky) with Copilot wants to merge 2 commits into
Michael Kovalsky (m-kovalsky) with Copilot wants to merge 2 commits into
Conversation
Co-authored-by: m-kovalsky <29556918+m-kovalsky@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix TypeError in vacuum_lakehouse_tables() with retain_n_hours=None
Fix TypeError in vacuum_lakehouse_tables() when retain_n_hours is None
Aug 18, 2026
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.
Since 0.16.0,
vacuum_lakehouse_tables()builds theretention_periodstring viaretain_n_hours // 24, which raisesTypeError: unsupported operand type(s) for //: 'NoneType' and 'int'whenretain_n_hoursis left at its documented default ofNone. The documented behavior ("the default retention period configured for the Delta table will be used") was only true prior to 0.16.0, when the function passedretain_n_hoursstraight through to_vacuum_table().Changes
src/sempy_labs/lakehouse/_lakehouse.py— computeretention_periodonce, before the loop, and only whenretain_n_hoursis provided:run_table_maintenance()already omitsretentionPeriodfrom the API payload when it isNone, so no change is needed there — the table's own configured retention applies. Zero-padding behavior from Fixvacuum_lakehouse_tablesretention period formatting for single-digit hours #1309 is preserved.tests/test_lakehouse.py— extracted the monkeypatch setup into a_patch_lakehousehelper and added a regression test assertingretention_period is Nonewhen the function is called withoutretain_n_hours.