Python ORM frame Pony Ten very convenient database operation tools , You can query data from in the form of objects , There is a problem in writing the server program today , I haven't met it before, so I want to share it with you .
Cannot load attribute BaseSinglePractice[99].Name: the database session is over
The main meaning is that the session with the database has ended , Cannot access properly .
You only need to add with db_session:
with db_session:
Just request a conversation with the database . The complete code is as follows :
with db_session:
# Get user records
results = select(user for user in User if user.IsDeleted is False)