Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -59,7 +59,11 @@ def text2sql(dataset_name, query_input):
|
|
59 |
try:
|
60 |
first_parquet = get_first_parquet(dataset_name)
|
61 |
except Exception as error:
|
62 |
-
return
|
|
|
|
|
|
|
|
|
63 |
first_parquet_url = first_parquet["url"]
|
64 |
print(first_parquet_url)
|
65 |
con = duckdb.connect()
|
@@ -84,7 +88,10 @@ def text2sql(dataset_name, query_input):
|
|
84 |
try:
|
85 |
sql_output = query_remote_model(text)
|
86 |
except Exception as error:
|
87 |
-
return
|
|
|
|
|
|
|
88 |
|
89 |
try:
|
90 |
query_result = con.sql(sql_output).df()
|
|
|
59 |
try:
|
60 |
first_parquet = get_first_parquet(dataset_name)
|
61 |
except Exception as error:
|
62 |
+
return {
|
63 |
+
query_output: "",
|
64 |
+
df:pd.DataFrame([{"error": f"❌ Could not get dataset schema. {error=}"}])
|
65 |
+
}
|
66 |
+
|
67 |
first_parquet_url = first_parquet["url"]
|
68 |
print(first_parquet_url)
|
69 |
con = duckdb.connect()
|
|
|
88 |
try:
|
89 |
sql_output = query_remote_model(text)
|
90 |
except Exception as error:
|
91 |
+
return {
|
92 |
+
query_output: "",
|
93 |
+
df:pd.DataFrame([{"error": f"❌ Unable to get the SQL query based on the text. {error=}"}])
|
94 |
+
}
|
95 |
|
96 |
try:
|
97 |
query_result = con.sql(sql_output).df()
|