apache_beam.yaml.json_utils module¶
Utilities for converting between JSON and Beam Schema’d data.
For internal use, no backward compatibility guarantees.
-
apache_beam.yaml.json_utils.
json_schema_to_beam_schema
(json_schema: Dict[str, Any]) → org.apache.beam.model.pipeline.v1.schema_pb2.Schema[source]¶ Returns a Beam schema equivalent for the given Json schema.
-
apache_beam.yaml.json_utils.
json_type_to_beam_type
(json_type: Dict[str, Any]) → org.apache.beam.model.pipeline.v1.schema_pb2.FieldType[source]¶ Returns a Beam schema type for the given Json (schema) type.
-
apache_beam.yaml.json_utils.
beam_type_to_json_type
(beam_type: org.apache.beam.model.pipeline.v1.schema_pb2.FieldType) → Dict[str, Any][source]¶
-
apache_beam.yaml.json_utils.
json_to_row
(beam_type: org.apache.beam.model.pipeline.v1.schema_pb2.FieldType) → Callable[[Any], Any][source]¶ Returns a callable converting Json objects to Beam rows of the given type.
The input to the returned callable is expected to conform to the Json schema corresponding to this Beam type.
-
apache_beam.yaml.json_utils.
json_parser
(beam_schema: org.apache.beam.model.pipeline.v1.schema_pb2.Schema, json_schema: Optional[Dict[str, Any]] = None) → Callable[[bytes], apache_beam.pvalue.Row][source]¶ Returns a callable converting Json strings to Beam rows of the given type.
The input to the returned callable is expected to conform to the Json schema corresponding to this Beam type.