Skip to content
This repository was archived by the owner on Dec 29, 2023. It is now read-only.

Commit 091f346

Browse files
authored
Update main.py
1 parent efb78ce commit 091f346

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: main.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ def clickhouse():
5353
if not query:
5454
return app.send_static_file('play.html')
5555

56-
if database:
57-
database = f"USE {database}; "
56+
if database:
57+
query = f"USE {database}; {query}".encode()
5858

59-
result, errmsg = chdb_query_with_errmsg(database + query, format)
59+
result, errmsg = chdb_query_with_errmsg(query, format)
6060
if len(errmsg) == 0:
6161
return result
6262
return errmsg
@@ -73,8 +73,9 @@ def play():
7373

7474
if database:
7575
database = f"USE {database}; ".encode()
76+
query = database + query
7677

77-
result, errmsg = chdb_query_with_errmsg(database + query, format)
78+
result, errmsg = chdb_query_with_errmsg(query, format)
7879
if len(errmsg) == 0:
7980
return result
8081
return errmsg

0 commit comments

Comments
 (0)