【发布时间】:2019-09-09 09:13:39
【问题描述】:
如果 peewee 中的记录来自 bulk_create,我需要返回 ids
我可以做这样的事情
from models import Table
t = Table.create(**data)
print(i.id)
我得到了一条新记录的 id
但如果我尝试
t = Table.bulk_create(list[**data])
for i in t:
print(i.id)
这里我得到一个错误:'t' is 'NoneType'
那么我如何从 peewee bulk_create 获取 id?
【问题讨论】:
标签: python database orm peewee