Closed kipyin closed 5 years ago
I think, we should keep all the database mess in pokemaster.query
module, including the (only) function, pokemaster.session.get_session()
. If we need to change the db, use pokemaster.query.bind_session()
.
Fixed in dae9187739b9b0b618a946523eeecad3c118c239
https://github.com/kipyin/pokemaster/blob/80a839dc83e54a4adcfd4ffa79b78e479885e1fd/pokemaster/pokemon.py#L29-L33
Binding a
pokemaster.pokemon.Pokemon
object to a db session couples the class with a db schema, and having them completely separated is much preferred.But if we remove this class var, how can properly instantiate a
pokemaster.pokemon.Pokemon
instance?E.g., how do we get the correct database for the following helper class method?
https://github.com/kipyin/pokemaster/blob/80a839dc83e54a4adcfd4ffa79b78e479885e1fd/pokemaster/pokemon.py#L301