moj-analytical-services / pydbtools

Python version of dbtools
https://moj-analytical-services.github.io/pydbtools/
10 stars 2 forks source link

CCDE-388: Allow users to provide/edit utils #55

Closed isichei closed 2 years ago

isichei commented 2 years ago

In the AP move to EKS we need to provide a different way to set temp_database_name/location see the changes here

This hotfix branch should be the default in the next release.

Atm a lot of the utils are hardcoded or cannot be changed in order for others to change how these things are defined. I think it would be good to allow users to update \ change utils at runtime of pydbtools. Have a look at how aws-wrangler changes it’s settings (config). They essentially have a settings class in a private module then create an object of that class and expose that in a public module as the utils/settings. Then you can just edit the values/functions of that utils object.

Docs

Code

mratford commented 2 years ago

https://github.com/moj-analytical-services/pydbtools/tree/utils_config

I'm not sure this is the best way of going about this (I'm pretty sure that the _Utils class that calls an instance of itself is among the worst code I've ever written). It might be better to pass alternative functions as parameters to existing fixed functions, I'll have a think about how to do that.