This folder contains scripts to generate simulated data and to popopulate the database.
Client:
- Python 3
- pandas
- dotenv
- sqlalchemy
- psycopg2
Server:
- PostgreSQL running in localhost
Before running any script, configure the .env file. To use the example:
$ cp env-example .env
Variables in the .env file are:
DB_USER
: Username to connect to the databaseDB_PASSWORD
: Password to connecto to the databaseDB_NAME
: Database nameCOMPANIES_NUM
: Number of companies to generateMAX_CUSTOMER_NUM
: Maximum number of customers to generateMAX_INVENTORY_ITEM_NUM
: Maximum number of inventory items to generate for each companyMAX_ORDER_BY_DAY
: Maximun number of orders by day to generate for each companyMAX_ITEMS_BY_ORDER
: Maximun number of items to generate by orderMAX_QUANTITY_BY_ITEM
: Maximun quantity for inventory item in ordersSIM_START_DATE
: Start date for simulation (ISO format)SIM_END_DATE
: End date for simulation (ISO format)
Each script has a class with the same name and each class has a method
generate()
. Classes are:
- Company
- Customer
- Inventory
- WareHouse
- SalesOrder
- SalesOrderLine
To run any of these scripts, use for example:
$ python company.py
Keep the same order to run these scripts.
Furthermore, there is a script that run all of them:
$ python main.py
Depending on values assigned in the .env
file, time running can be large.