I have a Discord Bot that's on a many a servers, I'm revamping most all of it and came to a personal crossroads. While developing I used the schema that I saw Red Discord Bot use which under the hood is dicts in memory saved on update to a
json file for each cog. (cog being a category that the bot deals in).
#init stuff = dataIO.load_json(...) #close dataIO.save_json(... , stuff)
upon init / close of each cog. This performs well, although I feel as though using a database may be a better approach considering it can encompass all cogs as a whole rather than dealing with each cog as a file individually, thus duplicating data.
I've seen the
json file method as a standard among many developers and another being mongoDB to store their data. I have used both in my original application but I'd like to see what I could use that would eliminate using both.
So, I know that there will be opinion based biases involved in this, but dealing with python strictly, what is the most efficient method of storing data for each server and user on those servers. (my point being made on using some sort of database relational or nonSQL/un-relational)
The reason I ask is sometimes using pure python is (in some cases) "better" than using an API to a database written in another language.
I have taken a dive (even tested) quite a few other databases including
sqlite (eww) and seems I just need it laid out for me. I'm looking for something that is more efficient than using the
json approach I touched on above but not heavy that will make coding/debugging a hassle. Plus, I really want to steer clear from writing one more blasted SQL statement
I know I should have included this in the above but I want to make sure it's read. I'm looking for something that is not
in-memory as I'd like to conserve my memory usage. I have no concerns as to the disk space used but memory could pose a concern depending on the usage it imposes. Memory mapped is ok, although I found MongoDB a hassle to configure to not use ALL my memory as my current setup is standalone but plan to move to using 2 servers very soon.