Closed dachengx closed 1 month ago
Hi, @dachengx. This is great! I have one concern regarding this update—with such an implementation, all different DB instances can only act like a global variable throughout the whole scope and lifetime of any script. I understand that this is usually the requirement for data processing, but I'm wondering if we are sure we have zero need to keep separate DBs? Probably also a question for @napoliion
@yuema137 I think you mean switching DB.
Sorry, let me first merge it for faster iteration. Please @yuema137 and @napoliion still comment about your opinion on this PR. If a problem happens I will make patches.
Similar to https://github.com/XENONnT/straxen/pull/1426.
The motivation is to limit the number of connections to DB. With singleton pattern:
the instance will be only one given the same
*args, **kwargs
.Also, this PR reorganizes
logger
by only retaining one handler, otherwise, you will see multiple messages with the same content.