guptaakashdeep commented on issue #535:
URL: https://github.com/apache/iceberg-python/issues/535#issuecomment-2815332224
@kevinjqliu @Fokko Is it still being worked on? I followed the conversation
on this. I understand the issue that currently `Table` is not JSONSerializable
but `TableMetadata` is because it extends `IcebergBaseModel`.
Do we want to make a Pydantic `TableModel` that extends IcebergBaseModel
which will have same properties as Table class and then utilize to serialize
and deserialize it ?
Sample Implementation:
```python
# __init__.py
class CatalogModel(IcebergBaseModel):
name: str
properties: Dict[str, Any]
class TableModel(IcebergBaseModel):
_identifier: Identifier
metadata: TableMetadata
metadata_location: str
catalog: CatalogModel
config: Dict[str, str]
# Excluded IO for now -- as that class is not serializable, do we want
to just keep the class Name here or make that serializable too?
class Table:
"""An Iceberg table."""
_identifier: Identifier = Field()
metadata: TableMetadata
metadata_location: str = Field()
io: FileIO
catalog: Catalog
config: Dict[str, str]
.....
def serialize(self):
model = TableModel(
_identifier = self._identifier,
metadata = self.metadata,
metadata_location = self.metadata_location,
catalog = CatalogModel(
name = self.catalog.name,
properties = self.catalog.properties
),
config = self.config
)
return model.model_dump_json()
```
something of this sort ?
--
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]