chore: allow development without DB reconnection#25
Conversation
havok2063
left a comment
There was a problem hiding this comment.
So to clarify, does this change remove the need to do that local hack when developing, the one where we setup the db globally and remove the specific dependencies on each route?
For local development using the tunnel, I would set db_reset: false, but for production we'd set db_reset: true? Is that correct?
|
Yes, that's all correct. For production I think I have also found a better way of handling the reflection in |
havok2063
left a comment
There was a problem hiding this comment.
That all sounds good to me. Thanks for suggesting a fix for this. It was a tad annoying having to tweaks things locally and not accidentally commit them.
Adds some additional options to facilitate development without the DB connection having to be recreated for every query (which takes a long time with Peewee using a tunnel as the reconnection forces the models to be re-reflected).
sdssdbdoes not try to connect to the default profile when the database is imported. In development this will fail but take a long time becausepipelines.sdss.orgis not reacheable. This should be ok since every query hasget_pw_dbas a dependency.If
db_serveris None, it does not try to connect to a profile and usesdb_user,db_host, etc.If
db_resetisFalse, it does not close the connection, and the next time the DB is required it does not try to reconnect.For development one would edit
~/.config/sdss/valis.yamland addWithout a
valis.yamlfile or environment variables everything should behave as it did.