Treat missing as optional in UpdateNamespacePropertiesResponse - #4074
Open
mayuriphad wants to merge 1 commit into
Open
mayuriphad wants to merge 1 commit into
mayuriphad wants to merge 1 commit into
Conversation
The REST spec marks the missing field of UpdateNamespacePropertiesResponse as optional and nullable, and servers such as Lakekeeper omit it when no requested removal was missing. pyiceberg required it, so update_namespace_properties raised a ValidationError after the server had applied the change. Default it to an empty list and map null to []. Closes apache#4066
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 #4066
Rationale for this change
In the REST spec,
UpdateNamespacePropertiesResponserequires onlyupdatedandremoved.missingis optional andnullable: true("Server's do not need to implement this"). pyiceberg's response model declaredmissing: list[str] = Field()as required. So against a server that omits it (Lakekeeper, or anything built on iceberg-rust's response type),RestCatalog.update_namespace_propertiesraised:That happens after the server had already applied the update.
missingnow defaults to an empty list, and an explicitnullis mapped to[]. That keepsPropertiesUpdateSummary.missingalist[str]as before, so callers see no type change.Are these changes tested?
Yes.
test_update_namespace_properties_200_without_missingcovers a response that omitsmissingand one with"missing": null. Both fail onmainwith theValidationErrorabove and pass with this change. The rest oftests/catalog/test_rest.pypasses locally, excepttest_rest_catalog_with_google_credentials_path, which fails onmaintoo becausegoogle-authisn't installed in my environment.Are there any user-facing changes?
Yes, a bug fix:
update_namespace_propertiesworks with REST servers that omit the optionalmissingfield.