Skip to content

Good practices with converters and before_request #5179

Answered by davidism
azmeuk asked this question in Q&A
Discussion options

You must be logged in to vote

open the database connection in the converter, and check if it is already opened in the before_request callback

That's fine.

It's essentially what happens with Flask-SQLAlchemy, although there it's more hidden. The connection isn't made until you actually access the database with something like db.session.execute(), then it's reused.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by azmeuk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants