MCPcopy
hub / github.com/feast-dev/feast / table_format_from_json

Function table_format_from_json

sdk/python/feast/table_format.py:512–538  ·  view source on GitHub ↗

Create TableFormat instance from JSON string. This is a convenience function that parses a JSON string and creates the appropriate TableFormat instance. Useful for loading table format configurations from files or network requests. Args: json_str (str): JSON string con

(json_str: str)

Source from the content-addressed store, hash-verified

510
511
512def table_format_from_json(json_str: str) -> TableFormat:
513 """
514 Create TableFormat instance from JSON string.
515
516 This is a convenience function that parses a JSON string and creates
517 the appropriate TableFormat instance. Useful for loading table format
518 configurations from files or network requests.
519
520 Args:
521 json_str (str): JSON string containing table format configuration.
522
523 Returns:
524 TableFormat: An instance of the appropriate TableFormat subclass.
525
526 Raises:
527 json.JSONDecodeError: If the JSON string is invalid.
528 ValueError: If format_type is not recognized.
529 KeyError: If format_type field is missing.
530
531 Examples:
532 Load from JSON string:
533
534 >>> json_config = '{"format_type": "delta", "checkpoint_location": "s3://bucket/checkpoints"}'
535 >>> delta_format = table_format_from_json(json_config)
536 """
537 data = json.loads(json_str)
538 return table_format_from_dict(data)
539
540
541def table_format_from_proto(proto: "TableFormatProto") -> TableFormat:

Calls 1

table_format_from_dictFunction · 0.85