xcx0902 commited on
Commit
d7effdb
·
verified ·
1 Parent(s): 38a6743

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -25,6 +25,10 @@ def Connect():
25
  cursor = conn.cursor()
26
  return conn, cursor
27
 
 
 
 
 
28
  thread = threading.Thread(target=Upload)
29
  thread.start()
30
 
@@ -36,10 +40,14 @@ def HuggingFaceSpaceRoot():
36
  def UptimeRobot():
37
  return "OK"
38
 
39
- @app.get("/sql")
40
  @app.post("/sql")
41
  def execute_sql(param: sql):
42
  conn, cursor = Connect()
43
  cursor.execute(param.sql)
44
- conn.commit()
45
- conn.close()
 
 
 
 
 
 
25
  cursor = conn.cursor()
26
  return conn, cursor
27
 
28
+ def Close(conn: sqlite3.Connection):
29
+ conn.commit()
30
+ conn.close()
31
+
32
  thread = threading.Thread(target=Upload)
33
  thread.start()
34
 
 
40
  def UptimeRobot():
41
  return "OK"
42
 
 
43
  @app.post("/sql")
44
  def execute_sql(param: sql):
45
  conn, cursor = Connect()
46
  cursor.execute(param.sql)
47
+ Close(conn)
48
+
49
+ @app.get("/sql")
50
+ def execute_sql_get(sql: str):
51
+ conn, cursor = Connect()
52
+ cursor.execute(sql)
53
+ Close(conn)