Osoby z USA

Sto osób w jednej tabeli, z miejscami, które do siebie pasują, i numerami SSN, których nikt nie może mieć.

en-US 1 tabela 100 wierszy CSV

Imiona idą za kolumną płci. Stan i kod ZIP idą za miastem i pochodzą z tego samego rejestru pocztowego, więc miasto, stan i kod do siebie pasują. Każdy numer SSN ma obszar 666, którego urząd nigdy nie wydaje, więc test nie dotknie numeru prawdziwej osoby.

Zmień count, żeby dostać więcej wierszy, i seed, żeby dostać inne osoby. Usuń kolumnę, której nie potrzebujesz, albo dodaj inną z listy generatorów.

Przepis

people-us.yaml
# A hundred people in the United States, in one table.
#
# Each row has a name, a gender, a birth date, a social security number, a city,
# its state and a ZIP code. First names follow the gender, and the state and the
# ZIP code follow the city. Every social security number is in area 666, which
# is never issued.
#
#   qadg generate people-us.yaml
#
# writes person.csv and run-note.json. The same seed gives the same rows on
# every machine.
version: "0.1"
seed: "people-us"
locale: en-US
entities:
  person:
    count: 100
    primary_key: [ssn]
    fields:
      first_name: { generator: first_name }
      last_name:  { generator: last_name }
      gender:     { generator: gender }
      birth_date: { generator: birth_date }
      ssn:        { generator: ssn, unique: true }
      city:       { generator: city }
      state:      { generator: region }
      zip:        { generator: postal_code }
    consistency:
      - first_name matches: [gender]
output:
  format: csv

Uruchomienie

Zapisz przepis i w tym samym folderze uruchom to polecenie. Niżej jest to, co program przy nim wypisał.

terminal
$ qadg generate people-us.yaml
       person: 100 rows, 8 columns
       person: state follows city, though no rule says so
       person: zip follows city and state, though no rule says so
1 table, 100 rows written

Co zapisuje

person.csv

Pierwsze 5 z 100 wierszy.

first_namelast_namegenderbirth_datessncitystatezip
IsabellaHillfemale1937-04-01666-97-2936HaskinsOH43525
DavidOsbornmale1940-05-06666-20-1309St. FrancisAR72464
JohnHansonmale1965-04-09666-01-5721ArgoniaKS67004
JavierSantosmale1958-02-25666-64-3250ElizabethNJ07206
KirkBeanmale2000-04-05666-31-2967WolcottNY14590

run-note.json

Seed, locale i wersje, z którymi ruszył przebieg, oraz każda zapisana tabela z liczbą wierszy i kolumn.