Spaces:
Running
Running
resolve error
Browse files
app.py
CHANGED
|
@@ -49,6 +49,15 @@ def sql_engine(query: str) -> str:
|
|
| 49 |
return f"Error: {str(e)}"
|
| 50 |
|
| 51 |
def query_sql(user_query: str) -> str:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
schema_info = (
|
| 53 |
"The database has a table named 'receipts' with the following schema:\n"
|
| 54 |
"- receipt_id (INTEGER, primary key)\n"
|
|
|
|
| 49 |
return f"Error: {str(e)}"
|
| 50 |
|
| 51 |
def query_sql(user_query: str) -> str:
|
| 52 |
+
"""
|
| 53 |
+
Converts a natural language query into an SQL statement and executes it.
|
| 54 |
+
|
| 55 |
+
Args:
|
| 56 |
+
user_query (str): A question or request in natural language to be converted into SQL.
|
| 57 |
+
|
| 58 |
+
Returns:
|
| 59 |
+
str: The execution result from the database.
|
| 60 |
+
"""
|
| 61 |
schema_info = (
|
| 62 |
"The database has a table named 'receipts' with the following schema:\n"
|
| 63 |
"- receipt_id (INTEGER, primary key)\n"
|