Embed Notice
HTML Code
Corresponding Notice
- Embed this notice@Pi_rat @p @SuperDicq @pwm
>I will look into this, Im not sure how I would go about it at all since I have very surface level understanding of OOP.
I think he meant to make a class specifically for database operations. The database connection/initialization code will go into the class init and the cursor will be a class variable only accessible by the member functions. Then in your main routine you instantiate the class, let's say an object called db which you then use to call the methods providing only the information necessary. For instance db.addtag(path, newTagString), db.deletePath(path), etc.
It's been a while since I wrote any Python btw, I only use jupyter-notebook with some forecasting and data analysis libs nowadays.