Modified DBClient to instead take in a DBEngine class which handles setup and connection verification.
Modified the flask_db code to allow for specifying which DBClient to fetch a session from, but defaulting to just have one.
Context for reviewers
On my project, we're soon going to need two DB clients, one for a Postgres DB, and one for an Oracle DB. This makes doing that possible.
Note that in doing this I noticed a few additional things we might want to consider, although I've left them out of this PR to keep it focused:
Migrations are still tied to the postgres DB client
Multiple clients of the same type (ie. two postgres) wouldn't be configurable, we'd need to adjust DBConfig and have that pass in
As there might be some discussion still, I haven't updated all the docs, especially anything regarding the engine. Will do that if this solution looks to be solid
Testing
make test all tests pass - added and moved a few based on the changes
Ticket
https://github.com/navapbc/template-application-flask/issues/151
Changes
Modified DBClient to instead take in a DBEngine class which handles setup and connection verification.
Modified the flask_db code to allow for specifying which DBClient to fetch a session from, but defaulting to just have one.
Context for reviewers
On my project, we're soon going to need two DB clients, one for a Postgres DB, and one for an Oracle DB. This makes doing that possible.
Note that in doing this I noticed a few additional things we might want to consider, although I've left them out of this PR to keep it focused:
As there might be some discussion still, I haven't updated all the docs, especially anything regarding the engine. Will do that if this solution looks to be solid
Testing
make test
all tests pass - added and moved a few based on the changes