A simple example

This is a simple example of how to use fodder to generate some data. It contains a schema.yaml file and some hand crafted input data in data/.

Schema

maps:
  - name: BUYER_NAME
    file: data/BUYER_NAME.csv
  - name: SELLER_NAME
    file: data/SELLER_NAME.csv
categories:
  - name: BUYER
    file: data/BUYER.csv
  - name: SELLER
    file: data/SELLER.csv
fields:
  # SALESID	INTEGER	Primary key, a unique ID value for each row. Each row represents a sale of one or more tickets for a specific event, as offered in a specific listing.
  - name: SALESID
    type: Bothify
    args:
      format: "#########"
  # SELLERID	INTEGER	Foreign-key reference to the USERS table (the user who listed the tickets).
  - name: SELLERID
    type: WeightedCategory
    args:
      from_category: SELLER
  # SELLERNAME	VARCHAR(50)	The name of the user who listed the tickets.
  - name: SELLERNAME
    type: Map
    args:
      from_map: SELLER_NAME
      key: SELLERID
  # BUYERID	INTEGER	Foreign-key reference to the USERS table (the user who bought the tickets).
  - name: BUYERID
    type: WeightedCategory
    args:
      from_category: BUYER
  # BUYERNAME	VARCHAR(50)	The name of the user who bought the tickets.
  - name: BUYERNAME
    type: Map
    args:
      from_map: BUYER_NAME
      key: BUYERID
  # QTYSOLD	SMALLINT	The number of tickets that were sold, from 0 to 9. (A maximum of 8 tickets can be sold in a single transaction.)
  - name: QTYSOLD
    type: Digit
  # PRICEPAID	DECIMAL(8,2)	The total price paid for the tickets, such as 75.00 or 488.00. The individual price of a ticket is PRICEPAID/QTYSOLD.
  - name: PRICEPAID
    type: Bothify
    args:
      format: "^##.##"
  # SALETIME	TIMESTAMP	The full date and time when the sale was completed, such as 2008-05-24 06:21:47.
  - name: SALETIME
    type: DateTime
    args:
      start: 2023-01-01T00:00:00Z
      end: 2023-01-31T00:00:00Z
      format: "%Y-%m-%d %H:%M:%S"

Data

# data/BUYER.csv
ID
0000001
0000002
0000003
0000004
0000005
# data/BUYER_NAME.csv
ID,NAME
0000001,JOHN DOE
0000002,JOHN SMITH
0000003,ALICE DOE
0000004,SALLY SMITH
0000005,MARY JONES
# data/SELLER.csv
ID
0000001
0000002
0000003
0000004
0000005
# data/SELLER_NAME.csv
ID,NAME
0000001,COMPANY INC.
0000002,LOL INC.
0000003,123 INC.
0000004,ANOTHER INC.
0000005,ZZZ PTY LTD.

Output

# tables/SALES.csv
SALESID,SELLERID,SELLERNAME,BUYERID,BUYERNAME,QTYSOLD,PRICEPAID,SALETIME
541725862,0000002,JOHN SMITH,0000003,123 INC.,0,563.54,2023-01-09 21:50:00
751725001,0000004,SALLY SMITH,0000002,LOL INC.,3,889.20,2023-01-05 18:58:00
868507369,0000004,SALLY SMITH,0000004,ANOTHER INC.,7,764.86,2023-01-06 05:00:00
306917643,0000002,JOHN SMITH,0000005,ZZZ PTY LTD.,9,553.21,2023-01-21 17:47:00
731805330,0000005,MARY JONES,0000005,ZZZ PTY LTD.,6,183.24,2023-01-23 19:52:00