Features overview¶
django-data-seed is a pipeline: it works out what to generate, makes each
value fit the column, wires up relationships correctly, keeps each row
coherent, and inserts everything fast — after checking your schema is
sound.
-
Every field type produces a valid value. Values are refined by the field's name (
city→ a city) and clamped to its constraints (max_length,choices, decimal precision, integer ranges, IP protocol). -
A foreign-key dependency graph seeds parents before children, reuses rows instead of exploding trees, and handles OneToOne, self-FKs, M2M, and cycles.
-
Fields within a row agree: ordered lifecycle dates, one persona per name set, one address per city/state/zip.
-
Single- and multi-column uniqueness tracked in memory — no per-value
SELECT, no collisions. -
Unapplied migrations, schema drift, and missing tables are caught before any row is written.
-
File/Image/FilePath fields get real, tiny files under your
MEDIA_ROOT, honouring each field'supload_to.
The generation pipeline¶
For every field, the engine resolves a value in this order — first match wins:
- User override — an explicit value/callable/pool you supplied.
- NULL injection — for nullable, non-required columns (configurable).
- Weighted choice — for
choicesfields (skewed, not uniform). - Field-name inference —
email,city,price,latitude, … - Field-type provider — dispatched by the field's real MRO.
Whatever comes out is then decorated to fit the column (length, numeric range, decimal shape) and, for unique columns, checked against an in-memory set.
Performance & reproducibility¶
bulk_createin batches; one transaction per model (--atomic all|model|none).- Uniqueness handled in memory — zero per-value round-trips.
--seed Nmakes the entire run byte-for-byte reproducible.- Realism has an off switch:
--realism uniformfor dumb-fast noise.