Skip to content

TommyCosta/sql-query-generator

Repository files navigation

SQL Query Generator

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.

Technologies

Python 3.x, SQLite, argparse

Installation

  1. Ensure Python 3.x is installed.
  2. Clone the repository with:
git clone https://github.com/TommyCosta/sql-query-generator.git

Usage

  1. Generate the database:
python retailer_db_generator.py
  1. 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.

Output Examples

  1. 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:

Alt text

  1. 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.

Alt text

About

This program uses user input command line args to create and display the results of a SQL query within a simulated database.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages