Closed nebolax closed 5 months ago
@fengsp @davidism @rayluo I am looking forward for a review on this PR!
@nebolax This should be fixed in the latest version. Thanks for the PR, this demonstrated a cleaner fix than other PRs and it's coded it now directly in combination with some other items.
Heyy @Lxstr great that it was fixed! Could you include me in the flask-session's contributors list?
Closes #175
If someone runs multiple tests and each test initializes a new instance of flask app (and thus a new initialization of flask_session happens), it results in the following error:
This is because typically the sqlalchemy db object is global and thus it's metadata is kept between tests runs. Which means that if someone executes
class SomeTable(db.Model)
twice, it breaks because the table is already stored in the metadata.This PR solves this problem by setting
keep_existing
toTrue
, which means that if sessions table is already in the metadata, it will be reused instead of trying to create a new one.A test was also added for the mentioned change.