Getting started

From nothing to a dataset, a damaged copy and the answer for every damaged value. Every command and every output on this page comes from a real run.

Get it

Get it has the archive for each system, the installer for Windows, and how to build it from source. The examples below type qadg, so put the folder you unpacked it to on your PATH, or install it on Windows.

One value

terminal
$ qadg quick vin --count 3 --seed readme
1BYT5FU9749011245
C2W0U46N5PEY89060
BFXUMNKG544D46596

Without --seed every run draws new values. With it, the same values come back every time. qadg help generators lists everything this build can make, and Generators has the same list.

A whole dataset

Save this as shop.yaml:

shop.yaml
version: "0.1"
seed: "readme"
locale: en-US

entities:
  customer:
    count: 1000
    primary_key: ssn
    fields:
      first_name: { generator: first_name, required: true }
      last_name:  { generator: last_name, required: true, max_length: 30 }
      gender:     { generator: gender }
      birth_date: { generator: birth_date }
      ssn:        { generator: ssn, unique: true }
      city:       { generator: city }
      state:      { generator: region }
      zip:        { generator: postal_code }
      plan:       { values: [free, pro, team] }
    consistency:
      - first_name matches: [gender]

  payment:
    belongs_to: { customer: 0-5 }
    fields:
      card: { generator: card }

output:
  format: csv
  dir: ./data

Check it, then run it:

terminal
$ qadg validate shop.yaml
$ qadg generate shop.yaml
       customer: state follows city, though no rule says so
       customer: zip follows city and state, though no rule says so
shop.yaml can be used. Understood 2 entities and 10 fields.
A run of it would write 3524 rows in 2 tables.

data/customer.csv starts like this:

data/customer.csv
first_name,last_name,gender,birth_date,ssn,city,state,zip,plan
Joel,Cook,male,1936-11-30,666-18-0253,Saginaw,MI,48601,team
Brady,Santos,male,1985-10-04,666-18-1470,Tryon,NC,28782,pro
Marco,Richardson,male,1966-05-07,666-30-3256,Porterville,MS,39352,free

and data/payment.csv like this, each payment carrying the key of its customer:

data/payment.csv
card,customer
6243030000000001,666-18-0253
378282246310005,666-18-0253
371449635398431,666-18-0253
  • belongs_to: { customer: 0-5 } gives each customer zero to five payments.
  • matches keeps first names in line with the gender column. City, state and ZIP code agree without a rule, and validate says so.
  • required and max_length describe your columns. They also tell the damage below what to break.
  • seed makes the run repeatable. Change it for different data of the same shape.

Recipes lists every key.

Break it on purpose

Add three lines to the recipe:

added to shop.yaml
policy:
  layers: [L2, L3, REV]
  rows: 5%

and run it again, asking for the manifest as a Markdown table too:

terminal
$ qadg generate --overwrite --manifest markdown shop.yaml

The data comes out as before, with damage in 5% of the rows, and beside it is expectation-manifest.json. Each entry says where the damaged value is, what it was before and after, and what your application should do with it. The manifest shows a few entries and explains each field.

Next