in client/python/polaris/catalog/models/table_metadata.py [0:0]
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([
])
_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of each item in schemas (list)
_items = []
if self.schemas:
for _item in self.schemas:
if _item:
_items.append(_item.to_dict())
_dict['schemas'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in partition_specs (list)
_items = []
if self.partition_specs:
for _item in self.partition_specs:
if _item:
_items.append(_item.to_dict())
_dict['partition-specs'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in sort_orders (list)
_items = []
if self.sort_orders:
for _item in self.sort_orders:
if _item:
_items.append(_item.to_dict())
_dict['sort-orders'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in snapshots (list)
_items = []
if self.snapshots:
for _item in self.snapshots:
if _item:
_items.append(_item.to_dict())
_dict['snapshots'] = _items
# override the default output from pydantic by calling `to_dict()` of each value in refs (dict)
_field_dict = {}
if self.refs:
for _key in self.refs:
if self.refs[_key]:
_field_dict[_key] = self.refs[_key].to_dict()
_dict['refs'] = _field_dict
# override the default output from pydantic by calling `to_dict()` of each item in snapshot_log (list)
_items = []
if self.snapshot_log:
for _item in self.snapshot_log:
if _item:
_items.append(_item.to_dict())
_dict['snapshot-log'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in metadata_log (list)
_items = []
if self.metadata_log:
for _item in self.metadata_log:
if _item:
_items.append(_item.to_dict())
_dict['metadata-log'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in statistics_files (list)
_items = []
if self.statistics_files:
for _item in self.statistics_files:
if _item:
_items.append(_item.to_dict())
_dict['statistics-files'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in partition_statistics_files (list)
_items = []
if self.partition_statistics_files:
for _item in self.partition_statistics_files:
if _item:
_items.append(_item.to_dict())
_dict['partition-statistics-files'] = _items
return _dict