Spaces:
Sleeping
Sleeping
Commit Β·
b9c9c85
1
Parent(s): 6129457
feat: add main menu options and scripts
Browse files
app.py
CHANGED
|
@@ -317,6 +317,13 @@ CREATE TABLE product (id number, category text, name text, description text, pri
|
|
| 317 |
st.code(format_sql(query), language="sql")
|
| 318 |
|
| 319 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 320 |
# Define a function for the About page
|
| 321 |
def about():
|
| 322 |
st.title("π§βπ» About")
|
|
@@ -395,6 +402,7 @@ pages = [
|
|
| 395 |
"Interactive Demo",
|
| 396 |
"About",
|
| 397 |
"References",
|
|
|
|
| 398 |
]
|
| 399 |
selected_page = st.sidebar.radio("Go to", pages)
|
| 400 |
if st.sidebar.button("Clear All"):
|
|
@@ -416,3 +424,5 @@ elif selected_page == "About":
|
|
| 416 |
about()
|
| 417 |
elif selected_page == "References":
|
| 418 |
references()
|
|
|
|
|
|
|
|
|
| 317 |
st.code(format_sql(query), language="sql")
|
| 318 |
|
| 319 |
|
| 320 |
+
def database_query_page():
|
| 321 |
+
query = st.text_input("Enter SQL query")
|
| 322 |
+
if st.button("Execute"):
|
| 323 |
+
result = execute_sql(query)
|
| 324 |
+
st.dataframe(pd.DataFrame(result), hide_index=True)
|
| 325 |
+
|
| 326 |
+
|
| 327 |
# Define a function for the About page
|
| 328 |
def about():
|
| 329 |
st.title("π§βπ» About")
|
|
|
|
| 402 |
"Interactive Demo",
|
| 403 |
"About",
|
| 404 |
"References",
|
| 405 |
+
"Database Query",
|
| 406 |
]
|
| 407 |
selected_page = st.sidebar.radio("Go to", pages)
|
| 408 |
if st.sidebar.button("Clear All"):
|
|
|
|
| 424 |
about()
|
| 425 |
elif selected_page == "References":
|
| 426 |
references()
|
| 427 |
+
elif selected_page == "Database Query":
|
| 428 |
+
database_query_page()
|