sebpretzer commented on issue #229:
URL: https://github.com/apache/iceberg-python/issues/229#issuecomment-1874187979
@Fokko To follow up, we have fixed this internally ourselves with something
similar to below:
```python
from pydantic import BaseModel, field_validator
from pyiceberg.schema import Schema, assign_fresh_schema_ids
class FooBarModel(BaseModel)
iceberg: Schema
@field_validator("iceberg")
def field_ids_in_preorder(cls, v: Schema) -> Schema:
if v != assign_fresh_schema_ids(v):
raise ValueError("Schema ids not in preorder")
return v
```
It places a bit more burden on users to properly order the field ids, but
the schema will no longer change underneath them. If you want something similar
upstream in `Schema`, I am happy to take a crack at it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]