Skip to content

Commit 7c11e1c

Browse files
Merge pull request #28 from shadab-mohammad-oracle/patch-5
Update main.py
2 parents 2b53422 + ea9c93c commit 7c11e1c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

app/main.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ def test_latency(
4040
url: str = Form(""),
4141
interval: float = Form(1.0),
4242
period: int = Form(10),
43+
custom_sql: str = Form(""),
4344
user: str = Depends(get_current_user)
4445
):
45-
# All credentials are held transiently only for test run
4646
result = dbtools.run_latency_test(
4747
dbtype=dbtype,
4848
host=host,
@@ -52,9 +52,9 @@ def test_latency(
5252
database=database,
5353
url=url,
5454
interval=interval,
55-
period=period
55+
period=period,
56+
custom_sql=custom_sql
5657
)
57-
# Render index.html with results below
5858
return templates.TemplateResponse("index.html", {
5959
"request": request,
6060
"user": user,
@@ -66,7 +66,8 @@ def test_latency(
6666
"database": database,
6767
"url": url,
6868
"interval": interval,
69-
"period": period
69+
"period": period,
70+
"custom_sql": custom_sql
7071
})
7172

7273
@app.post("/api/test-latency")
@@ -80,9 +81,9 @@ def api_test_latency(
8081
url: str = Form(""),
8182
interval: float = Form(1.0),
8283
period: int = Form(10),
84+
custom_sql: str = Form(""),
8385
credentials: HTTPBasicCredentials = Depends(security)
8486
):
85-
# For API/CLI use -- returns result JSON
8687
get_current_user(credentials)
8788
result = dbtools.run_latency_test(
8889
dbtype=dbtype,
@@ -93,6 +94,7 @@ def api_test_latency(
9394
database=database,
9495
url=url,
9596
interval=interval,
96-
period=period
97+
period=period,
98+
custom_sql=custom_sql
9799
)
98100
return JSONResponse(result)

0 commit comments

Comments
 (0)