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
# 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ł.
$ 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_name | last_name | gender | birth_date | ssn | city | state | zip |
|---|---|---|---|---|---|---|---|
| Isabella | Hill | female | 1937-04-01 | 666-97-2936 | Haskins | OH | 43525 |
| David | Osborn | male | 1940-05-06 | 666-20-1309 | St. Francis | AR | 72464 |
| John | Hanson | male | 1965-04-09 | 666-01-5721 | Argonia | KS | 67004 |
| Javier | Santos | male | 1958-02-25 | 666-64-3250 | Elizabeth | NJ | 07206 |
| Kirk | Bean | male | 2000-04-05 | 666-31-2967 | Wolcott | NY | 14590 |
run-note.json
Seed, locale i wersje, z którymi ruszył przebieg, oraz każda zapisana tabela z liczbą wierszy i kolumn.