【发布时间】:2020-04-16 21:06:56
【问题描述】:
我有 26 个来自开源的 json 文件(它们对单词有含义)
他们被命名为a.json,b.json,c.json........z.json
我正在寻找关于如何使用flask sql alchemy /pythonic 方式将这些数据存储在数据库(MySQL)中的建议,以便数据如下:
{
"a cappella": {
"word": "a cappella",
"wordset_id": "5feb6f679a",
"meanings": [
{
"id": "492099d426",
"def": "without musical accompaniment",
"example": "they performed a cappella",
"speech_part": "adverb"
},
{
"id": "0bf8d49e2e",
"def": "sung without instrumental accompaniment",
"example": "they sang an a cappella Mass",
"speech_part": "adjective"
}
]
},
"A.D.": {
"word": "A.D.",
"wordset_id": "b7e9d406a0",
"meanings": [
{
"id": "a7482f3e30",
"def": "in the Christian era",
"speech_part": "adverb",
"synonyms": [
"AD"
]
}
]
},.........
}
是为整个数据创建一个表还是为每个 json 文件创建一个表?
任何指导链接都会很有帮助,TIA
【问题讨论】:
-
MySQL 支持 JSON 作为数据类型:dev.mysql.com/doc/refman/5.7/en/json.html
标签: python flask flask-sqlalchemy pymysql