I am making a tg bot and i need to store users data, Im learning python by myself so im not sure how its usually done. I will use an online db, but Im not sure how exactly do i make an in-between data storage (to make it easier for my program to interact with data) and do i even need to do it. I made a class for data storage with a dict and a couple methods to interact with this dict so it can pull data from db into this dict and then my program will interact with it, but im not sure do I make a giant dict with all users data or do i create an instance of this class with personal dict for every new user? Second seems better but maybe having so many instances of a class is bad? Maybe I dont use a in-between storage and just get everything directly from db? thanks in advance!
submitted by /u/bruhmoment0000001
[link] [comments]
r/learnpython I am making a tg bot and i need to store users data, Im learning python by myself so im not sure how its usually done. I will use an online db, but Im not sure how exactly do i make an in-between data storage (to make it easier for my program to interact with data) and do i even need to do it. I made a class for data storage with a dict and a couple methods to interact with this dict so it can pull data from db into this dict and then my program will interact with it, but im not sure do I make a giant dict with all users data or do i create an instance of this class with personal dict for every new user? Second seems better but maybe having so many instances of a class is bad? Maybe I dont use a in-between storage and just get everything directly from db? thanks in advance! submitted by /u/bruhmoment0000001 [link] [comments]
I am making a tg bot and i need to store users data, Im learning python by myself so im not sure how its usually done. I will use an online db, but Im not sure how exactly do i make an in-between data storage (to make it easier for my program to interact with data) and do i even need to do it. I made a class for data storage with a dict and a couple methods to interact with this dict so it can pull data from db into this dict and then my program will interact with it, but im not sure do I make a giant dict with all users data or do i create an instance of this class with personal dict for every new user? Second seems better but maybe having so many instances of a class is bad? Maybe I dont use a in-between storage and just get everything directly from db? thanks in advance!
submitted by /u/bruhmoment0000001
[link] [comments]