You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "kdbhiggins (via GitHub)" <gi...@apache.org> on 2024/03/15 16:44:56 UTC
[PR] Fix CommitTableRequest serialisation [iceberg-python]
kdbhiggins opened a new pull request, #525:
URL: https://github.com/apache/iceberg-python/pull/525
I discovered an error when trying to deserialize the `CommitTableRequest` object.
```
request = CommitTableRequest(
requirements=(AssertTableUUID(uuid='4bfd18a3-74c6-478e-98b1-71c4c32f4163'),),
identifier=TableIdentifier(namespace=['a'], name='b'),
)
deserialized_request = CommitTableRequest.model_validate_json(request.model_dump_json())
```
raises
`TypeError: Can't instantiate abstract class TableRequirement with abstract method validate`
I added a test to round-trip serialize/deserialize the `CommitTableRequest`. After investigating I was able to fix it by using [Discriminated Unions](https://docs.pydantic.dev/latest/concepts/unions/#discriminated-unions), which seem like a natural fit for the `TableUpdate` and `TableRequirement`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Fix CommitTableRequest serialisation [iceberg-python]
Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko merged PR #525:
URL: https://github.com/apache/iceberg-python/pull/525
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org