4 ms·
This is tricky, on the one hand keeping everything related to the database close to or in the database is probably cleaner (in the clean architecture sort of wa
by luord 6y ago
This is tricky, on the one hand keeping everything related to the database close to or in the database is probably cleaner (in the clean architecture sort of way), as it eases a separation between the business rules and the data saving and loading.
On the other hand, doing this loses a lot of the sugar and development benefits of using the ORM (either Django or SQLAlchemy, which I prefer), that are often enough—and perhaps preferred—for 95% of projects.
If I were to choose, I'd pick the ORM, though trying to place it as high in the stack as possible.