Wolfie-Home / webserver2

IFTTT-like web server that connects IoT devices, written in Python Flask and ReactJS
6 stars 1 forks source link

clean up database? #22

Open cjackie opened 7 years ago

cjackie commented 7 years ago

Should we clean up the database? like

kbumsik commented 7 years ago

In my perspective the current interface used for DB is relatively clean. You only need to use service layer to store and retrieve data. However, the biggest problem is the Entity Relationship for table is somewhat somewhat complicated so that it is hard to maintain or add more feature later. This will be the same even though we use ORM, because the table design will remain unchanged. In this point of view, MongoDB looks promising for me. I will study for it for a while and let's see what we can do.

cjackie commented 7 years ago

The thing is I feel like you are writing a lot of things that can easily be done using an ORM. For example, I assume "service layer" is where communication to the actual DB happens. For simple store, retrieve, update, delete, using ORM can achieve without writing this layer... and relationship management comes free from ORM. like cascading delete...

If the project stays the same in complexity, it is okay not witch to a ORM.

But re-inventing wheel is good for learning.

kbumsik commented 7 years ago

Don't worry. I will consider using ORM-like layer for MongoDB. If I decide not to use MongoDB, I will switch to SQLAlchemy gradually but it is not the highest priority unless I need to change the design of the current database.

cjackie commented 7 years ago

I strongly prefer SQLAlchemy.