3 ms·
"“Database should store data not logic!” — well, no. This is called data-base, not data-bag. Databases are specialized engines to deal with, you guessed it, dat
by astine 6y ago
"“Database should store data not logic!” — well, no. This is called data-base, not data-bag. Databases are specialized engines to deal with, you guessed it, data. And they are extremely efficient at it. Not to mention - majority of the job backends do, is dealing with data. This is good for prototyping. Unfortunately more often than not — prototypes lands on production with updated connection string and debug=False."
Or, as I like frame the issue, there's a difference between a datastore and a database. Datastores/persistence engines store your data in manner that you can get it back later. Think of a key-value store for example. A database, however, assists you with the management of your data, including helping to ensure correctness of the data, tracking changes, among other things. For most systems lot of work is already managed in-database whether you like it or not.
- RussianCow 6y agoTo add to this, if you need your data to be consistent at all times, it probably makes sense to let the database take care of that instead of managing it at a higher level (and hoping you don't make mistakes). This is where keeping your data-related logic in-DB is really advantageous.
- scarmig 6y agoAnd even the most conservative use of databases usually relies on them enforcing particular application logic. E.g., foreign keys or non null constraints. Or, to be even more radical, maintaining structured data itself, with separate tables comprised of different columns with different data types.
- richardwhiuk 6y agoWhen you highly scale a database, you normally find you can't rely on the database to maintain foreign key constraints.