I want to create something which keeps track of which tenants live in what apartment and does some other things like calculating ROI and keeping track of costs.
What is recommended to do in this case? Use a class which would be called Apartments and then have tenants that live within a certain instance / apartment? Or would it be better to keep track of something like that with a database? Or perhaps a combination of those two?
I don't really know what the possibilities are and I tried googling / stackoverflowing it but I couldn't really find an answer to my question.
PS. the programming language I'll be using is Python.
The first question you should be asking yourself is whether you want your data to be persistent meaning - do you want your data to be gone once you stop your application or not?
If you don't need persistence, then you don't need database.
If the question is - yes, I want persistence - then we can dig deeper. Do you need the data to be accessible by different users, possibly doing modifications to the data at the same time? If no, then don't use a database. Store the data in some file in a format that is easy to parse.
If - again - we say yes, then databases are one way to solve the issue. Next question would be - which database do you want? Relational, key-value, document, graph? (Usually if you don't know the answer to this question mean you want a relational one...)
As Sushant mentioned a minute ago - you will also need some ways to represent the data in your application. You will have some structures (let's call it a model), and you will load the data into your model and store the data from into the database. ORM tools do that for you, but if it is the first time for you to see such things, you might also be good without.
Having said that, you are up to a long journey. Remember to have fun.
Should I use a database or a class?