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

Refactor database initialization #1805

Closed
laurent-laporte-pro opened this issue Nov 13, 2023 · 0 comments · Fixed by #1837
Closed

Refactor database initialization #1805

laurent-laporte-pro opened this issue Nov 13, 2023 · 0 comments · Fixed by #1837

Comments

@laurent-laporte-pro
Copy link
Contributor

The solution is based on a refactoring of the init_db function and repositories. The aim is to modify this function so that the DBSessionMiddleware is no longer declared, as this middleware will be declared at the same time as the other middlewares.

Data initialization must be carried out in separate functions that will be called after database initialization. In this way, repository instantiation will no longer generate SQL queries.

On the other hand, some repositories will have to be modified so that a specific SqlAlchemy session is used instead of the global db variable. The db variable will be used if no session is supplied as an initialization parameter.

This feature is required to implement #1724

@laurent-laporte-pro laurent-laporte-pro added this to the v2.16 milestone Nov 13, 2023
@laurent-laporte-pro laurent-laporte-pro modified the milestones: v2.16, v2.16.1 Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants