Failure to obtain data often occurs during sqlalchemy operation, but there is data in mysql.

recently, it often appears when using sqlalchemy+python+gunicorn to develop a small project. Sqlalchemy reads the data and returns None, but it is possible to view the data in the database. As a novice, I suspect that there is something wrong with my writing with sqlalchemy code. I hope you can take a look at it for me.
is my code for inserting data:

clipboard.png
clipboard.png

:
clipboard.png

with chance, sometimes the user has just registered successfully, and I see that there is data in the table, but the next second when I query the user table (through the custom search method), what is returned is None,. Is there a problem with what I wrote? no one around me contacted python, so I came here to consult you!


take a look at it in debugger? See here that you don't create a session in your create_consumer_user , but add it directly. Once the session is close, you need to recreate it

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b332-2ba5c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b332-2ba5c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?