-
Notifications
You must be signed in to change notification settings - Fork 291
[feat request] Make Table
JSON serializable
#535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We should be able to (de)serialize it using Pydantic. That's probably also faster. |
oh thanks for the hint, looks like using the
but only on |
There's already a |
@kevinjqliu if no one is on this, can look to take this on |
@db-trin-life yep assigned to you! |
@kevinjqliu @Fokko Is it still being worked on? I followed the conversation on this. I understand the issue that currently Do we want to make a Pydantic Sample Implementation: # __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 ? |
Table
/ TableMetadata
JSON serializableTable
JSON serializable
Table is a bit more tricky since I don't think we want to serialize the whole Catalog and FileIO. I think the config contains everything we need to re-create the FileIO and Catalog, so that would be one option. @kevinjqliu did you have any specific use-case in mind? |
I think using |
Closing for now :) |
Feature Request / Improvement
The REST Catalog exposes
Table
andTableMetadata
information as HTTP endpoints in JSON format (link). This information is similar to the internal state ofTable
andTableMetadata
objects in Python.It would be great to make these JSON serializable.
Example
Error
The text was updated successfully, but these errors were encountered: