ExtensionData和DailyData之间存在外来关系。我读取了ExtensionData的ID,将其输入到DailyData中。但是当我这样做时,我遇到了一个OperationalError数据库被锁定了。我该如何避免?
def create_ext_data(link, nr_users, downloads, rating, nr_reviews):
"""
"""
db.connect()
with db.transaction():
link_to = ExtensionData.get(ExtensionData.link == link).id
DailyData.create(link_to=link_to, nr_users=nr_users, nr_reviews=nr_reviews,
downloads=downloads, rating=rating)
db.close()