fakedata
fakedata is a small command line utility that generates random data.
Table Of Contents
Overview
Here is a list of examples to get a feeling of how fakedata works
$ fakedata email country
cemshid@example.com Afghanistan
LucasPerdidao@example.me Turkey
arthurholcombe1@test.us Saint Helena
iamgarth@example.us Montenegro
joelcipriano@test.name Croatia
keryilmaz@test.name Vietnam
plbabin@test.org Lithuania
bermonpainter@test.us Haiti
opnsrce@example.name Malaysia
ankitind@test.info Virgin Islands, British
Limit the number of rows:
$ fakedata --limit 5 country.code
SH
CF
GQ
PE
FO
Choose a different output format:
$ fakedata --format=csv product.category product.name
Shoes,Rankfix
Automotive,Namis
Movies,Matquadfax
Tools,Damlight
Computers,Silverlux
Industrial,Matquadfax
Home,Sil-Home
Health,Toughwarm
Shoes,Freetop
Tools,Domnix
Generators
fakedata provides a number of generators. You can see the full list running
the following command:
$ fakedata --generators
color one word color
country Full country name
country.code 2-digit country code
date date
domain domain
domain.tld example|test
# ...
# It's a long list :)
Some generators allow you to pass in a range to constraint the output to a
subset of values:
$ fakedata int,1..100 # will generate only integers between 1 and 100
$ fakedata int,50.. # specifying only min number works too
$ fakedata int,50 # also works
The enum generator allows you to specify a set of values. It comes handy when
you need random data from a small subset of values:
$ fakedata enum --limit 5
foo
baz
foo
foo
baz
$ fakedata enum,bug..feature..question..duplicate --limit 5
question
duplicate
duplicate
bug
feature
fakedata can generate insert statements. By default, it uses the name of the
generators as column names:
$ fakedata --format=sql --limit 1 email domain
INSERT INTO TABLE (email,domain) values ('yigitpinar@example.org','example.me');
You can specify the name of the column using a field with the following format
column_name=generator:
$ fakedata --format=sql --limit 1 login=email referral=domain
INSERT INTO TABLE (login,referral) values ('calebogden@example.com','test.me');
fakedata --format=sql --limit=1 --table=users login=email referral=domain
INSERT INTO users (login,referral) VALUES ('mikema@example.com' 'test.us');
How to install
Homebrew
fakedata can be installed through Homebrew:
$ brew tap lucapette/tap
$ brew install fakedata
Standalone
fakedata can be installed as an executable. Download the latest
compiled binaries and put it
anywhere in your executable path.
Source
Please refer to our contributing guidelines to build and
install fakedata from the source.
How to contribute
Please refer to our contributing guidelines.
Code of Conduct
You are expected to follow our code of conduct when
interacting with the project via issues, pull requests or in any other form.
Many thanks to the awesome contributor covenant initiative!
License
MIT License Copyright (c) [2017] Luca Pette