From 943335cf5dc05ad4bc7e8e19f29ceed347425e7a Mon Sep 17 00:00:00 2001 From: Shadab Mohammad Date: Fri, 4 Jul 2025 02:26:48 +1000 Subject: [PATCH] Update README.md --- README.md | 116 +++++++++++++++--------------------------------------- 1 file changed, 32 insertions(+), 84 deletions(-) diff --git a/README.md b/README.md index 713b243..a87710e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # DELTA - FastAPI based WebApp to Test Database Latency (NEW, 2025) -This project is a secure, lightweight SaaS-like database latency testing GUI and API, built with FastAPI. +This project is a secure, lightweight SaaS-like database latency testing tool with a Mobile GUI, along with REST API. -https://github.com/user-attachments/assets/e3eaf179-914b-4c17-bc47-35f17e86aee0 +Built with ❤️ using FastAPI. ## Clone Repository ## @@ -56,95 +56,43 @@ http://localhost:8000 ![Screenshot 2025-07-03 at 11 26 30 PM](https://github.com/user-attachments/assets/f1b17fb8-f637-4b86-95c9-52dd0b6e2067) -### 5. API Usage via Curl/CLI Example: +### 5. Default SQL : API Usage via Curl/CLI MySQL Example ```bash -curl -u admin:change_this -X POST http://localhost:8000/api/test-latency -d dbtype=mysql -d host=localhost -d port=3390 -d username=testuser -d password="YOurP@ssword#12" -d database=testdb -d interval=1 -d period=10 | jq . -``` +curl -u admin:change_this -X POST http://localhost:8000/api/test-latency \ + -d dbtype=mysql \ + -d host=localhost \ + -d port=3390 \ + -d username=testuser \ + -d password="YourPassword1##" \ + -d database=testdb \ + -d interval=1 \ + -d period=10 \ + | jq . ``` - % Total % Received % Xferd Average Speed Time Time Time Current - Dload Upload Total Spent Left Speed -100 1260 100 1145 100 115 107 10 0:00:11 0:00:10 0:00:01 259 -{ - "success": true, - "error": null, - "latency_stats": { - "p99": 65.00130997534143, - "p90": 64.45847470022272, - "avg": 59.44308740145061, - "stddev": 3.661004661748353, - "mean": 59.44308740145061, - "runs": 10 - }, - "details": [ - { - "timestamp": "2025-07-04 01:18:22", - "latency_ms": 61.802583004464395, - "success": true, - "error": null - }, - { - "timestamp": "2025-07-04 01:18:23", - "latency_ms": 61.06654200993944, - "success": true, - "error": null - }, - { - "timestamp": "2025-07-04 01:18:24", - "latency_ms": 64.39145799959078, - "success": true, - "error": null - }, - { - "timestamp": "2025-07-04 01:18:25", - "latency_ms": 53.58212499413639, - "success": true, - "error": null - }, - { - "timestamp": "2025-07-04 01:18:26", - "latency_ms": 65.06162500591017, - "success": true, - "error": null - }, - { - "timestamp": "2025-07-04 01:18:27", - "latency_ms": 57.83200000587385, - "success": true, - "error": null - }, - { - "timestamp": "2025-07-04 01:18:29", - "latency_ms": 54.59125000925269, - "success": true, - "error": null - }, - { - "timestamp": "2025-07-04 01:18:30", - "latency_ms": 57.854083002894185, - "success": true, - "error": null - }, - { - "timestamp": "2025-07-04 01:18:31", - "latency_ms": 60.93537498963997, - "success": true, - "error": null - }, - { - "timestamp": "2025-07-04 01:18:32", - "latency_ms": 57.31383299280424, - "success": true, - "error": null - } - ] -} +### 6. Custom User SQL : API Usage via Curl/CLI MySQL Example + +To test with a custom SQL query from the command line, simply add a -d custom_sql="YOUR SQL HERE" parameter to your curl command, like this: + +```bash +curl -u admin:change_this -X POST http://localhost:8000/api/test-latency \ + -d dbtype=mysql \ + -d host=localhost \ + -d port=3390 \ + -d username=testuser \ + -d password="YourPassword1##" \ + -d database=testdb \ + -d interval=1 \ + -d period=10 \ + -d custom_sql="SELECT * FROM mytable WHERE status='ACTIVE' LIMIT 10" \ + | jq . ``` -## Command-Line (delta.py) Usage — Secure, No Stored Credentials +- If `custom_sql` is included (and not empty), that query is used for measuring latency (instead of `SELECT 1`). -The original `delta.py` script remains available for CLI power users and can test Oracle, PostgreSQL, MySQL, and URLs. **No credentials are stored in this file**; you must supply all values as arguments or interactively via a prompt. +- All other parameters stay the same as before. +- You can enter multi-line SQL in the terminal by wrapping it in quotes, or you can pipe in a file with `-d custom_sql="$(cat myquery.sql)"`. ## Databases Supported 🔌 :