Bulk CSV Generation for Database Seeding
Seeding a dev database with realistic data turns demos and tests from "works on my machine" into believable. CSV.si generates up to 100,000 rows of synthetic data per run; you pipe the file into Postgres `COPY`, MySQL `LOAD DATA`, or a `mongoimport` and you're done in under a minute.
Why CSV beats SQL fixtures
CSV is faster to import (one transaction, no parser-per-row), easier to inspect (open in Excel), and database-agnostic (one file, many targets). SQL INSERT fixtures hard-code the dialect — useless when you swap MySQL for Postgres.
Postgres
psql -d dev -c "\copy users(name,email,country) FROM 'users.csv' CSV HEADER"
MySQL
mysql -e "LOAD DATA LOCAL INFILE 'users.csv' INTO TABLE users FIELDS TERMINATED BY ',' ENCLOSED BY '\"' IGNORE 1 ROWS" dev
MongoDB
mongoimport --db dev --collection users --type csv --headerline --file users.csv
Frequently asked questions
What's the realistic upper bound?
CSV.si generates up to 100k rows per CSV. For millions, generate a few CSVs and concatenate, or run multiple imports.
Can I match foreign-key relationships?
Generate parent tables first, export their IDs, and reference them when generating child tables. CSV.si lets you re-use a generated column via copy-paste.