@@ -49,9 +49,10 @@ def chdb_query_with_errmsg(query, format):
4949@auth .login_required  
5050def  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,17 +63,26 @@ def clickhouse():
6263@app .route ('/' , methods = ["POST" ]) 
6364@auth .login_required  
6465def  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 ) 
7787def  handle_404 (e ):
7888    return  app .send_static_file ('play.html' )
0 commit comments