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
- 0:00 A table with no key turned 75 pounds into 150.
- 0:35 The idea
- 1:16 Setup
- 1:40 Entity, attribute, value
- 2:09 The queries that expose it
- 2:26 Run the EAV
- 3:01 One god table
- 3:25 Update and delete
- 3:49 Run the god table
- 4:07 No keys
- 4:21 A retry loads it twice
- 4:41 Run the keys
- 5:07 What this does not show
- 5:28 Mistakes to avoid
- 5:52 My take and next steps
- 6:15 Recap
Files
- eav.py (39 lines)
- god.py (44 lines)
- nokeys.py (29 lines)
- run.py (8 lines)
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.