Skip to content

Anuar-boop/mock-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

mock-data

Realistic mock data generator for databases. Zero dependencies.

Features

  • 6 schemas: users, products, orders, blog posts, comments, transactions
  • 4 output formats: SQL INSERT, CSV, JSON, SQLite database
  • Foreign key relationships - orders reference users and products, comments reference posts and users
  • Unique constraints - emails are unique, SKUs are unique
  • Configurable row counts per table or --all N for everything
  • Date ranges - control the time span of generated data
  • Seeded randomness - same seed produces identical output every time
  • Realistic data - real first/last names, proper email formats, phone numbers, price ranges

Usage

# Generate 100 of everything as JSON
python mock_data.py --format json --all 100

# Generate specific tables
python mock_data.py --format json --users 50 --products 30 --orders 200

# Output as SQL INSERT statements
python mock_data.py --format sql --all 50 -o seed.sql

# Output as CSV files (one per table)
python mock_data.py --format csv --all 100 -o ./data/

# Output as SQLite database
python mock_data.py --format sqlite --all 500 -o mock.db

# Reproducible output with seed
python mock_data.py --format json --all 20 --seed 42

# Custom date range
python mock_data.py --format json --all 50 --start-date 2025-01-01 --end-date 2025-12-31

Schemas

users

Column Type Notes
id int Primary key
first_name str From 72 common names
last_name str From 64 common surnames
email str Unique, based on name
phone str +1 format
password_hash str SHA-256 (not real passwords)
is_active bool 90% active
created_at datetime ISO 8601
updated_at datetime ISO 8601

products

Column Type Notes
id int Primary key
name str Adjective + noun combo
description str Auto-generated
price float 4.99 - 299.99
category str 6 categories
stock int 0 - 500
sku str Unique SKU-XXXXX
is_active bool 95% active
created_at datetime ISO 8601

orders

Column Type Notes
id int Primary key
user_id int FK -> users
status str pending/processing/shipped/delivered/cancelled/refunded
total float Calculated from items
item_count int 1-5 items per order
items json Array of {product_id, quantity, unit_price}
shipping_address str Generated street address
created_at datetime ISO 8601
updated_at datetime ISO 8601

posts

Column Type Notes
id int Primary key
author_id int FK -> users
title str Template + tech topic
slug str URL-safe title
body str Multi-paragraph
status str draft/published/archived
tags json Array of topics
view_count int 0 - 10000
created_at datetime ISO 8601
published_at datetime ISO 8601, nullable

comments

Column Type Notes
id int Primary key
post_id int FK -> posts
user_id int FK -> users
body str Template-based
is_approved bool 90% approved
created_at datetime ISO 8601

transactions

Column Type Notes
id int Primary key
user_id int FK -> users
order_id int FK -> orders, nullable
type str purchase/refund/subscription/payout/fee/transfer
amount float Negative for refunds/fees
currency str USD
status str completed/pending/failed
reference str TXN-XXXXXXXXXXXX
created_at datetime ISO 8601

Requirements

  • Python 3.8+
  • No external dependencies

License

MIT

About

Realistic mock data generator for databases. SQL, CSV, JSON, SQLite output. Zero dependencies.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages