[BUG] SQLDB save wrong flatten results
jieguangzhou opened this issue · 0 comments
jieguangzhou commented
def _model_update_impl_flatten(
db,
ids: t.List[t.Any],
predict_id: str,
outputs: t.Sequence[t.Any],
):
table_records = []
def random_id():
return str(uuid.uuid4().hex)
for ix in range(len(outputs)):
for r in outputs[ix]:
d = {
'_input_id': str(ids[ix]),
'_source': random_id(),
'output': outputs[ix], # wrong here
}
table_records.append(d)
for r in table_records:
if isinstance(r['output'], dict) and '_content' in r['output']:
r['output'] = r['output']['_content']['bytes']
db.databackend.insert(f'_outputs.{predict_id}', table_records)
Need to change to save 'output': r
,