Spaces:
Runtime error
Runtime error
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -213,7 +213,8 @@ def construct_with_stats(final_query, subquery_info):
|
|
| 213 |
|
| 214 |
with_as_statements = []
|
| 215 |
for subquery_name, subquery in subquery_info.items():
|
| 216 |
-
|
|
|
|
| 217 |
with_as_statements.append(with_as_statement)
|
| 218 |
|
| 219 |
with_as_statement = "\n,\n".join(with_as_statements)
|
|
@@ -234,7 +235,8 @@ def get_subquery_info(json_response):
|
|
| 234 |
|
| 235 |
def add_single_query_description(query, json_response):
|
| 236 |
if json_response.get("query",None)!=None:
|
| 237 |
-
|
|
|
|
| 238 |
return query
|
| 239 |
|
| 240 |
def construct_final_query(query, json_response):
|
|
|
|
| 213 |
|
| 214 |
with_as_statements = []
|
| 215 |
for subquery_name, subquery in subquery_info.items():
|
| 216 |
+
description = subquery['description'].replace('\n',' ')
|
| 217 |
+
with_as_statement = f"{subquery_name} AS (\n{subquery['result']}\n) \n--{description}\n"
|
| 218 |
with_as_statements.append(with_as_statement)
|
| 219 |
|
| 220 |
with_as_statement = "\n,\n".join(with_as_statements)
|
|
|
|
| 235 |
|
| 236 |
def add_single_query_description(query, json_response):
|
| 237 |
if json_response.get("query",None)!=None:
|
| 238 |
+
description = json_response['query']['description'].replace('\n',' ')
|
| 239 |
+
query = f"{query}\n --{description}\n"
|
| 240 |
return query
|
| 241 |
|
| 242 |
def construct_final_query(query, json_response):
|