Quantcast
Channel: User Graygood - Stack Overflow
Viewing all articles
Browse latest Browse all 32

Reload Enum class on call

$
0
0

I have enum class, that is generated based on distinct names in Postgres table, like this.

CustomProperty = StrEnum('CustomProperty',                     [(i['metric_name'], i['metric_name'])                      for i in PostgresConnection().distinct_metrics()])

That is, when the application is loaded, the CustomProperty class gets initiated and stores the list of available properties.

Sometimes there appears to happen that new metrics are added to the table, but they are not getting dynamically added to this CustomProperty. So I need to reload the application, to reinitiate the class. I want to re-/initiate the class generation on call of certain function. How can it be done?


Viewing all articles
Browse latest Browse all 32

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>