Spaces:
Running
on
Zero
Running
on
Zero
Error handling
Browse files
app.py
CHANGED
@@ -58,8 +58,8 @@ def text2sql(dataset_name, query_input):
|
|
58 |
print(f"start text2sql for {dataset_name}")
|
59 |
try:
|
60 |
first_parquet = get_first_parquet(dataset_name)
|
61 |
-
except Exception as
|
62 |
-
return f"❌ Dataset does not exist or is not supported {
|
63 |
first_parquet_url = first_parquet["url"]
|
64 |
print(first_parquet_url)
|
65 |
con = duckdb.connect()
|
@@ -81,9 +81,11 @@ def text2sql(dataset_name, query_input):
|
|
81 |
|
82 |
### Response (use duckdb shorthand if possible) replace table name with {first_parquet_url} in the generated sql query:
|
83 |
"""
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
87 |
try:
|
88 |
query_result = con.sql(sql_output).df()
|
89 |
except Exception as error:
|
|
|
58 |
print(f"start text2sql for {dataset_name}")
|
59 |
try:
|
60 |
first_parquet = get_first_parquet(dataset_name)
|
61 |
+
except Exception as error:
|
62 |
+
return f"❌ Dataset does not exist or is not supported {error=}"
|
63 |
first_parquet_url = first_parquet["url"]
|
64 |
print(first_parquet_url)
|
65 |
con = duckdb.connect()
|
|
|
81 |
|
82 |
### Response (use duckdb shorthand if possible) replace table name with {first_parquet_url} in the generated sql query:
|
83 |
"""
|
84 |
+
try:
|
85 |
+
sql_output = query_remote_model(text)
|
86 |
+
except Exception as error:
|
87 |
+
return f"❌ Unable to get the SQL query based on the text. {error=}"
|
88 |
+
|
89 |
try:
|
90 |
query_result = con.sql(sql_output).df()
|
91 |
except Exception as error:
|