Пример #1
0
 def deserialize_complex_features(self, feature_schemas, row_dict):
     for feature_name, schema in feature_schemas.items():
         if feature_name in row_dict:
             bytes_reader = io.BytesIO(row_dict[feature_name])
             decoder = avro.io.BinaryDecoder(bytes_reader)
             row_dict[feature_name] = schema.read(decoder)
     return row_dict
Пример #2
0
 def avro_schema_json(self):
     with open("fixtures/schema.json", "r") as schema:
         return json.loads(schema.read())
Пример #3
0
 def record_data(self, avro_schema_json):
     with open("fixtures/record.json", "r") as schema:
         return json.loads(schema.read())
Пример #4
0
 def parse_schema(path="price_schema.avsc"):
     with open(path, 'r') as schema:
         return avro.schema.Parse(schema.read())