in client/python/polaris/catalog/models/table_metadata.py [0:0]
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of TableMetadata from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate({
"format-version": obj.get("format-version"),
"table-uuid": obj.get("table-uuid"),
"location": obj.get("location"),
"last-updated-ms": obj.get("last-updated-ms"),
"properties": obj.get("properties"),
"schemas": [ModelSchema.from_dict(_item) for _item in obj["schemas"]] if obj.get("schemas") is not None else None,
"current-schema-id": obj.get("current-schema-id"),
"last-column-id": obj.get("last-column-id"),
"partition-specs": [PartitionSpec.from_dict(_item) for _item in obj["partition-specs"]] if obj.get("partition-specs") is not None else None,
"default-spec-id": obj.get("default-spec-id"),
"last-partition-id": obj.get("last-partition-id"),
"sort-orders": [SortOrder.from_dict(_item) for _item in obj["sort-orders"]] if obj.get("sort-orders") is not None else None,
"default-sort-order-id": obj.get("default-sort-order-id"),
"snapshots": [Snapshot.from_dict(_item) for _item in obj["snapshots"]] if obj.get("snapshots") is not None else None,
"refs": dict(
(_k, SnapshotReference.from_dict(_v))
for _k, _v in obj["refs"].items()
)
if obj.get("refs") is not None
else None,
"current-snapshot-id": obj.get("current-snapshot-id"),
"last-sequence-number": obj.get("last-sequence-number"),
"snapshot-log": [SnapshotLogInner.from_dict(_item) for _item in obj["snapshot-log"]] if obj.get("snapshot-log") is not None else None,
"metadata-log": [MetadataLogInner.from_dict(_item) for _item in obj["metadata-log"]] if obj.get("metadata-log") is not None else None,
"statistics-files": [StatisticsFile.from_dict(_item) for _item in obj["statistics-files"]] if obj.get("statistics-files") is not None else None,
"partition-statistics-files": [PartitionStatisticsFile.from_dict(_item) for _item in obj["partition-statistics-files"]] if obj.get("partition-statistics-files") is not None else None
})
return _obj