Generate massive amounts of realistic fake CSV data for Data Loader
The templates directory contains an entire corporation full of fake data. Each entity will reference other entities in the same directory, same as the dataloader examples. Each entity file should contain the same number of rows as the other entities, and they can all be generated together by providing the number of desired rows. Lookup entities are the exception - there are only 10 of each generated.
// generate 10,000 records along with lookup entities
npm start 10000
// follow-on generation of 10,000 additional records, starting with id: 10001
npm run generate -- -t templates -o generated -r 10000 -s 10001
When provided the number of rows = n
, this will generate:
n
Companiesn
Contacts, one per companyn
Jobs, one per companyn
Candidates3n
Job Submissions, three per Candidate at one Jobn
Placements, one per Candidate at one Jobn
Locations, one per Companyn
Invoice terms, one per Companyn
Billing Profiles, one per Company- 10 General Ledger Accounts
- 10 Invoice Statement Message Templates
To load all of these records into a test corp, point Data Loader at the directory:
dataloader load ../path/to/generated
Given a template file and a location of an output file to generate, this method will generate an output file based on the provided template that contains the number of rows desired.
npm run generate -- --template path/to/templateFile.csv --output generatedOutputFile.csv --rows 1000
A template file contains two rows:
- Column header with column names that will be copied from the template to the generated output file.
- The data to generate for each row, including any replacements to make the data unique per row.
{{<faker.dataType>}}
= replace with faker-js generated data. See faker-js docs for available options.- Example:
{{name.lastName}}, {{name.firstName}} {{name.suffix}}
will generate random values for each row, formatted as:Corkery, Chaya Jr.
,Rippin, Tevin II
, etc.
- Example:
{{i}}
= replace with row number- Example:
candidate-{{i}}
will generatecandidate-1
,candidate-2
, etc.
- Example:
${<otherColumnName>}
= replace with the value of another column, allowing columns to contain values from one or more generated columns.- Example:
${firstName} ${middleName} ${lastName}
will format three generated columns into one resulting column.
- Example:
[[Option A|Option B|Option C|Option D]]
= replace with one of the given options in the vertical bar separated double bracket list. Simply cycles through the options on each row for an even distribution.