Upstream Pydantic 2.12.0 has a Regression that will break PyIceberg
envgap__apache__iceberg-python-2590
01 / FAILURE SIGNATURE
As reported upstream
E AttributeError: 'pydantic_core._pydantic_core.ValidationInfo' object has no attribute 'current_schema_id'
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
c92c471f6ac979456efcb1f0bf29dcdbd9f1740d- Manifest
pyproject.toml- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
apache/iceberg-python #2590 · read the original issue
### Apache Iceberg version
None
### Please describe the bug 🐞
Pydantic recently `2.12.0` and unfortunately it contains a regression: https://github.com/pydantic/pydantic/issues/12347 that `ValidationInfo` object will lose `field_names` in some cases.
I have a draft PR that experiments `2.12.0` and confirmed that the regression affect us: https://github.com/apache/iceberg-python/pull/2589
```
table_metadata = ValidationInfo(config={'title': 'TableMetadataV2', 'validate_by_alias': True, 'validate_by_name': True}, context=None, data=None, field_name=None)
def check_schemas(table_metadata: TableMetadata) -> TableMetadata:
"""Check if the current-schema-id is actually present in schemas."""
> current_schema_id = table_metadata.current_schema_id
E AttributeError: 'pydantic_core._pydantic_core.ValidationInfo' object has no attribute 'current_schema_id'
```
More info:
`pydantic 2.11.10`
<img width="1993" height="655" alt="Image" src="https://github.com/user-attachments/assets/90ae0cf4-d3fa-4d50-b94c-b1c8e791eae1" />
`pydantic 2.12.0`
<img width="2011" height="474" alt="Image" src="https://github.com/user-attachments/assets/a5e6f745-0054-46c3-9201-459499999ee9" />
While waiting for upstream fix, I think we may want to pin the pydantic version to `<2.12.0`
### Willingness to contribute
- [ ] I can contribute a fix for this bug independently
- [ ] I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- [ ] I cannot contribute a fix for this bug at this time04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]