Hey William,
I’m guessing in your comment you are referring ACID. If that’s the case, consistency is defined as

> Consistency in database systems refers to the requirement that any given database transaction must change affected data only in allowed ways. Any data written to the database must be valid according to all defined rules, including constraints, cascades, triggers, and any combination thereof.

As you said, constraints such as check, unique and foreign key’s are all ways to ensure the data in the database is consistent.

To understand consistency, consider several separate operations that change the data in the database in a consistent way. While each operation is consistent on its own, it might create a situation in the data that is not allowed by your app’s business rules.

For example, to transfer funds between two bank accounts you first need to decrease the amount from one account, and than increase the same amount in a different account. Each separate operation is consistent on its own, but if one of the operation fail, you leave one of the accounts either short or high. To make sure both operations happen together, and that no other process is changing the state of the data while we are working on them, we create a database transaction.

Hopefully this will help you understand the scope of this article better.

Regarding Django… Django merely provides an ORM. It’s layer of abstraction that provides easy access to database functions from python code. Everything you can do in the ORM you can also do directly in the database.

Written by

Full Stack Developer, Team Leader, Independent. More from me at https://hakibenita.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store