Faker Generator

The faker command generates data using Datafaker.

riotx faker [OPTIONS] FIELD... [REDIS COMMAND...]

where FIELD is a Faker field in the form field="expression".

To show the full usage, run:

riotx faker --help

You must specify at least one Redis command as a target.

Redis connection options apply to the root command (riotx) and not to subcommands.

In this example the Redis options will not be taken into account:

riotx faker id="numerify('####')" hset -h myredis.com -p 6380

Use index to access the current record count. You can for example do this:

riotx faker text="lorem.words(2)" id="index" hset test:#{id}"

Keys

Keys are constructed from input records by concatenating the keyspace prefix and key fields.

mapping
Import into hashes
riotx faker id="numerify('##########')" firstName="name.firstName" lastName="name.lastName" address="address.fullAddress" hset person:#{id}
Import into sets
riotx faker name="gameOfThrones.character" --count 1000 sadd got:characters --member "#{name}"

Data Providers

Faker offers many data providers. Most providers don’t take any arguments and can be called directly:

Simple Faker example
riotx faker firstName="name.firstName"

Some providers take parameters:

Parameter Faker example
riotx faker lease="number.digits(2)"

Here are a few sample Faker expressions:

  • regexify('(a|b){2,3}')

  • regexify('\\.\\*\\?\\+')

  • bothify('????',false)

  • name.firstName

  • name.lastName

  • number.numberBetween(1,10)

Options

--count <int>

Number of items to generate (default: 1000). Supports suffixes like 10k or 5m.

--locale <tag>

Faker locale for localized data generation (default: system locale). Examples: en_US, fr_FR, de_DE.

--help-faker [provider…​]

Display available Faker providers and their methods. If no provider is specified, lists all available providers.

Generate 100,000 records
riotx faker --count 100k id="numerify('####')" name="name.fullName" hset person:#{id}
Generate French localized data
riotx faker --locale fr_FR name="name.fullName" address="address.fullAddress" hset contact:#{index}
List available Faker providers
riotx faker --help-faker
Get help for specific provider
riotx faker --help-faker name address