Skip to content

Improve database connection handling #6

Description

@CharlesWithC

Currently, a random dhrid is generated at the start of each request, which is then tied to a newly created database connection.

All database queries using app.db require passing in dhrid to identify the connection, which is not elegant and developer-friendly.

Thus, it is proposed that, a new class that inherits the db class be created. This class would be tied to request so it does not interfere with app object. This class would have dhrid embedded. When a database method is called, it would prepend the dhrid argument and call parent class method.

This change would make database connection handling much more elegant, as no dhrid needs to be passed in manually.

However, it is still worth investigating using FastAPI builtin database handlers for more idiomatic database connection management.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions