Closed wordhui closed 3 years ago
I wrote minimaI wrote minimalist code to reproduce the buglist code to reproduce the bug
import asyncio
from tortoise.models import Model
from tortoise import Tortoise, fields
class User(Model):
username = fields.TextField()
password = fields.TextField()
async def init():
await Tortoise.init(
db_url='sqlite://Data.db',
modules={'models': ['__main__']}
)
await Tortoise.generate_schemas()
await User.create(username='张三', password='123456')
await User.create(username='李四', password='123456')
async def main():
await init()
await User.filter(username='张三', password='123456').first() # The bug can be reproduced by typing a breakpoint here
await User.filter(username='李四', password='123456').first()
if __name__ == '__main__':
asyncio.get_event_loop().run_until_complete(main())
The simple code reproduces the bug image as follows
@wordhui Thanks for submitting issue, I will take closer look.
python version Python 3.8.8 (default, Feb 24 2021, 15:54:32) [MSC v.1928 64 bit (AMD64)] :: Anaconda, Inc. on win32 tortoise-orm version 0.17.6 evaluate-async-code version 1.14
@wordhui Thanks for submitting issue, I will take closer look.
@uriyyo Thanks I finally updated the plugin version and the bug image, which may help
@wordhui This fix will be available at version 1.15
.
@wordhui This fix will be available at version
1.15
.
Many thanks
I will wait for the plugin to be released and upgrade
The efficiency of the fix is commendable
When I was using tortoise-orm, debugging the code, I found that line breaks will affect the results of code execution, the following is a GIF recorded when the problem occurs in the project