i got the example from the docs to work by making this change - but the better answer might be to change the prompt instead of cleaning the response:
diff --git a/llama_index/indices/struct_store/sql_query.py b/llama_index/indices/struct_store/sql_query.py
index 5dd5b6cf..27254eed 100644
--- a/llama_index/indices/struct_store/sql_query.py
+++ b/llama_index/indices/struct_store/sql_query.py
@@ -237,7 +237,7 @@ class BaseSQLTableQueryEngine(BaseQueryEngine):
def _parse_response_to_sql(self, response: str) -> str:
"""Parse response to SQL."""
- result_response = response.strip()
+ result_response = response.strip().split(";")[0] + ";"
return result_response
@abstractmethod
(also note that the sqllite example from the guide has an issue, at least with versions of libraries i'm using. i had to add a 'connection.commit()' after each execute when inserting rows or else it issued a ROLLBACK so no data ended up in the table)