Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -42,14 +42,29 @@ def HuggingFaceSpaceRoot():
|
|
| 42 |
def UptimeRobot():
|
| 43 |
return "OK"
|
| 44 |
|
| 45 |
-
|
| 46 |
-
def execute_sql(param: sql):
|
| 47 |
conn, cursor = Connect()
|
| 48 |
-
cursor.execute(
|
| 49 |
Close(conn)
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
@app.get("/sql")
|
| 52 |
def execute_sql_get(sql: str):
|
|
|
|
|
|
|
|
|
|
| 53 |
conn, cursor = Connect()
|
| 54 |
-
cursor.execute(sql)
|
| 55 |
Close(conn)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
def UptimeRobot():
|
| 43 |
return "OK"
|
| 44 |
|
| 45 |
+
def execute_sql(sql: str):
|
|
|
|
| 46 |
conn, cursor = Connect()
|
| 47 |
+
cursor.execute(sql)
|
| 48 |
Close(conn)
|
| 49 |
|
| 50 |
+
@app.post("/sql")
|
| 51 |
+
def execute_sql_post(param: sql):
|
| 52 |
+
return execute_sql(param.sql)
|
| 53 |
+
|
| 54 |
@app.get("/sql")
|
| 55 |
def execute_sql_get(sql: str):
|
| 56 |
+
return execute_sql(sql)
|
| 57 |
+
|
| 58 |
+
def select(sql: str):
|
| 59 |
conn, cursor = Connect()
|
| 60 |
+
result = cursor.execute(sql).fetchall()
|
| 61 |
Close(conn)
|
| 62 |
+
return result
|
| 63 |
+
|
| 64 |
+
@app.post("/select")
|
| 65 |
+
def select_post(param: sql):
|
| 66 |
+
return select(param.sql)
|
| 67 |
+
|
| 68 |
+
@app.get("/select")
|
| 69 |
+
def select_get(sql: str):
|
| 70 |
+
return select(sql)
|