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
def avro_schema_json(self): with open("fixtures/schema.json", "r") as schema: return json.loads(schema.read())
def record_data(self, avro_schema_json): with open("fixtures/record.json", "r") as schema: return json.loads(schema.read())
def parse_schema(path="price_schema.avsc"): with open(path, 'r') as schema: return avro.schema.Parse(schema.read())