如果是整数,如何用.in_进行选择?当我尝试插入整数时,出现错误我的专栏是数组和整数。
#My try
check = await db.execute(MarriagePlayer.select()
.where(
(MarriagePlayer.male_childrens.in_([1,2])) |
(MarriagePlayer.woman_childrens.in_([1]),
MarriagePlayer.chat_id == msg.receiver_id)))
#Error
return value if isinstance(value, list) else list(value)
TypeError: 'int' object is not iterable
我相信您的.in_
应该可以正常工作。您的错误似乎来自此行:
return value if isinstance(value, list) else list(value)
我怀疑您的值是int
,因此list(value)
与TypeError: 'int' object is not iterable
一起崩溃。尝试使用return value if isinstance(value, list) else [value]
。