This Python CLI tool uses user input command line args to create and display the results of a SQLite query within a simulated database. It is intended to assist Technical Support agents troubleshoot databases more efficiently, without knowing how to write in SQL. Formatting has been included so the displayed results are easeier to comprehend quickly.
Python 3.x, SQLite, argparse
- Ensure Python 3.x is installed.
- Clone the repository with:
git clone https://github.com/TommyCosta/sql-query-generator.git- Generate the database:
python retailer_db_generator.py- Run query_generator with arguments:
python query_generator.py --itemId <ID> --itemState <STATE>Usable arguments:
- --itemId – Filter by Item ID (integer).
- --itemState – Filter by Item State (e.g. "ForSale").
- --stockCount – Filter by available inventory count.
- --orderId - Filter by order ID (integer).
- --orderState - Filter by order state (e.g. "Delivered").
- --start - Start date of order placement(e.g. "2025-06-01").
- --end - End date of order placement (e.g. "2025-06-30").
- --db - Database to query (default is retailer_logs.db).
- --help - For additional help and options.
- Querying by an item state and stock count. In a real life scenarion, a support agent might use this to find which products are at risk of becoming out of stock:
- Querying by order state and date range. In a real life scenario, a support agent could use this to figure out which orders are still eing shipped that were ordered during the specified daterange.

