learning-it by example

Back to the video

Data Modelling Mistakes: EAV, God Tables, No Keys

A retry loaded 3 payments twice into a table with no key, and 75 pounds became 150.

Video #272 ยท Data modelling

Steps in the video

  1. 0:00 A table with no key turned 75 pounds into 150.
  2. 0:35 The idea
  3. 1:16 Setup
  4. 1:40 Entity, attribute, value
  5. 2:09 The queries that expose it
  6. 2:26 Run the EAV
  7. 3:01 One god table
  8. 3:25 Update and delete
  9. 3:49 Run the god table
  10. 4:07 No keys
  11. 4:21 A retry loads it twice
  12. 4:41 Run the keys
  13. 5:07 What this does not show
  14. 5:28 Mistakes to avoid
  15. 5:52 My take and next steps
  16. 6:15 Recap

Files

  • eav.py (39 lines)
  • god.py (44 lines)
  • nokeys.py (29 lines)
  • run.py (8 lines)

Download the code (zip)

Tested with

Python 3.12.15

What this does not show

Tiny made-up data in SQLite; the fair use of EAV is not shown and no speed or size is measured.

Sources

Learning IT by Example.