如題,想詢問版上有沒有人有碰過類似的情況有解呢?
附上程式碼:
# -*- coding: utf-8 -*-
import json
from data_struct import Test, create_session
from pprint import pprint
with open("./test_data.json", encoding="utf8") as f:
data = json.load(f)
session = create_session()
for row in data[0]["result"]["records"]:
data_obj = {"records": row}
session.add(Test(**data_obj))
session.commit()
print(row)
session.close()
output: