所以我希望从json转换到sqlite,因为我有一个json文件,其中有500,000个条目,并且追加+转储文件的时间太长。这是我的json文件的样子:
{"number": "1234567890", "used_services": [], "service": "television"},
{"number": "1234567890", "used_services": [], "service": "television"},
{"number": "1234567890", "used_services": [], "service": "television"},
{"number": "123457890", "used_services": [], "service": "television"},
{"number": "1234567890", "used_services": [], "service": "television"},
{"number": "123457890", "used_services": [], "service": "television"},
{"number": "1234567890", "used_services": [], "service": "television"},
{"number": "1234567890", "used_services": [], "service": "television"},
{"number": "1234567890", "used_services": [], "service": "television"},
{"number": "123467890", "used_services": [], "service": "television"},
{"number": "123567890", "used_services": [], "service": "television"},
{"number": "124567890", "used_services": [], "service": "television"},
{"number": "1234567890", "used_services": [], "service": "television"},
{"number": "1234567890", "used_services": [], "service": "television"},
{"number": "1234562390", "used_services": [], "service": "television"},
{"number": "1234567891", "used_services": [], "service": "television"},
以后我会在used_services中添加一个列表,如下所示:
x一个一个一个一个x一个一个二个x
1条答案
按热度按时间pn9klfpd1#
将所有内容放入一个列表中,然后使用
executemany()
,这样它将成批插入它们。