Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with scoped_session by sqlalchemy #2404

Open
Khachatur86 opened this issue Dec 15, 2023 · 1 comment
Open

Problem with scoped_session by sqlalchemy #2404

Khachatur86 opened this issue Dec 15, 2023 · 1 comment
Labels

Comments

@Khachatur86
Copy link

Khachatur86 commented Dec 15, 2023

I have an application flask-admin. There is an endpoint that accepts the id of the object and the name of the field to be modified by post request. The session_maker from sqlalchemy version 1.3.28 is used to create the scoped_session.
The problem occurred when upgrading to python version 3.11.
Problem description:

  1. An object is created and flush it to the database
  2. A post-request is sent to the endpoint to change the object field.
  3. Check if the object's field has changed
    At point 3, a DetachedInstanceError (sqlalchemy) occurs.
    By analyzing it was found out that the error is on the side of flask-admin - it removes the object from the session before the time.
    Please consider fixing this error. In python 3.11 the same test worked perfectly.
@samuelhwilliams
Copy link
Contributor

It would be very helpful if could you provide a code snippet that reproduces the error on python 3.11, and that works on an earlier python version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants