@@ -49,9 +49,10 @@ def chdb_query_with_errmsg(query, format):
49
49
@auth .login_required
50
50
def clickhouse ():
51
51
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 )
53
53
if not query :
54
- return app .send_static_file ('play.html' )
54
+ return "Ok" ,200
55
+ # return app.send_static_file('play.html')
55
56
56
57
result , errmsg = chdb_query_with_errmsg (query , format )
57
58
if len (errmsg ) == 0 :
@@ -62,20 +63,30 @@ def clickhouse():
62
63
@app .route ('/' , methods = ["POST" ])
63
64
@auth .login_required
64
65
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 )
67
68
if not query :
68
- return app .send_static_file ('play.html' )
69
+ return "Ok" ,200
70
+ # return app.send_static_file('play.html')
69
71
70
72
result , errmsg = chdb_query_with_errmsg (query , format )
71
73
if len (errmsg ) == 0 :
72
74
return result
73
75
return errmsg
74
76
75
77
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
+
76
86
@app .errorhandler (404 )
77
87
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')
79
90
80
91
81
92
host = os .getenv ('HOST' , '0.0.0.0' )
0 commit comments