Remove initial_change when CreateTableTransaction apply table updates on an empty metadata#1219
Conversation
kevinjqliu
left a comment
There was a problem hiding this comment.
thanks for the PR and adding the deprecation for initial_change.
I went down a deep rabbit hole on initial_change, the default values for TableMetadata, and how table updates are applied.
Let me clean up my notes and I'll post it here for reference
kevinjqliu
left a comment
There was a problem hiding this comment.
Thanks for the PR @HonahX. I like this solution. I've verified using the original issue's environment and it works.
Do you mind also removing these instances of initial_change?
iceberg-python/pyiceberg/table/__init__.py
Lines 706 to 721 in 9a6a9a1
Also, should we remove the unrelated changes from this PR? such as the library version upgrade/etc.
|
I want to get this PR in before the next release, please let me know if there's anything I can do to move it along! |
initial_change when CreateTableTransaction apply table updates on an empty metadatainitial_change when CreateTableTransaction apply table updates on an empty metadata
|
@kevinjqliu Thanks for reviewing this! I've updated the PR. It will be great to include this in the next release. |
Fokko
left a comment
There was a problem hiding this comment.
Looks good, thanks for catching this @kevinjqliu and fixing this @HonahX
|
|
||
| updated_metadata_data = copy(base_metadata.model_dump()) | ||
| updated_metadata_data["format-version"] = update.format_version | ||
| updated_metadata = base_metadata.model_copy(update={"format_version": update.format_version}) |
| last_column_id: int = Field(alias="last-column-id") | ||
|
|
||
| initial_change: bool = Field(default=False, exclude=True) | ||
| initial_change: bool = Field( |
There was a problem hiding this comment.
It is clean to go through the validation cycle, but I would be surprised if anyone would be relying on these properties
…es on an empty metadata (apache#1219) * make table metadata without validaiton * update deletes test * remove info * add deprecation message * revert lib version updates * remove initial_changes usage in code * move test to integration * fix typo * update error string
…es on an empty metadata (apache#1219) * make table metadata without validaiton * update deletes test * remove info * add deprecation message * revert lib version updates * remove initial_changes usage in code * move test to integration * fix typo * update error string
Fixes #864
Remove
initial_changeas described in Kevin's #950. This PR relies on Pydantic model's model_construct to create a model without validation. This gives us the flexibility to upgrade from TableMetadataV1 to TableMetadataV2 without worrying about validators terminating the process because of some incomplete fields.