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

Commit fe90a61

Browse files
author
root
committed
improve compatibility
1 parent 4028dc0 commit fe90a61

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

main.py

+17-6
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ def chdb_query_with_errmsg(query, format):
4949
@auth.login_required
5050
def clickhouse():
5151
query = request.args.get('query', default="", type=str)
52-
format = request.args.get('default_format', default="CSV", type=str)
52+
format = request.args.get('default_format', default="TSV", type=str)
5353
if not query:
54-
return app.send_static_file('play.html')
54+
return "Ok",200
55+
# return app.send_static_file('play.html')
5556

5657
result, errmsg = chdb_query_with_errmsg(query, format)
5758
if len(errmsg) == 0:
@@ -62,20 +63,30 @@ def clickhouse():
6263
@app.route('/', methods=["POST"])
6364
@auth.login_required
6465
def play():
65-
query = request.data
66-
format = request.args.get('default_format', default="CSV", type=str)
66+
query = request.data or None
67+
format = request.args.get('default_format', default="TSV", type=str)
6768
if not query:
68-
return app.send_static_file('play.html')
69+
return "Ok",200
70+
# return app.send_static_file('play.html')
6971

7072
result, errmsg = chdb_query_with_errmsg(query, format)
7173
if len(errmsg) == 0:
7274
return result
7375
return errmsg
7476

7577

78+
@app.route('/play', methods=["GET"])
79+
def handle_play():
80+
return app.send_static_file('play.html')
81+
82+
@app.route('/ping', methods=["GET"])
83+
def handle_ping():
84+
return "Ok", 200
85+
7686
@app.errorhandler(404)
7787
def handle_404(e):
78-
return app.send_static_file('play.html')
88+
return "Not Found", 404
89+
# return app.send_static_file('play.html')
7990

8091

8192
host = os.getenv('HOST', '0.0.0.0')

0 commit comments

Comments
 (0)