I'm using a Google's (outdated) BigQuery dialect for SQLAlchemy which I think may be problematic. If anyone can suggest a better way to work with BQ that'd be appreciated! But I've found an issue which I don't think is specific to that concern. Occasionally, I get an error
DatabaseError: (google.cloud.bigquery.dbapi.exceptions.DatabaseError) 400 Syntax error: Expected end of input but got identifier "SQLQuery" at [1:1]
when using SQLTableRetrieverQueryEngine. It looks like this part of the prompt ("SQLQuery:") isn't being trimmed from the SQL statement before it's put to BQ. There's a function
_parse_response_to_sql
(
https://github.com/jerryjliu/llama_index/blob/be0ded30701f45bd097b30a00fa93d2cdf06a592/llama_index/indices/struct_store/sql_query.py#L242) which attempts to trim according to the position of "SQLResult:" but there's no trimming going on for "SQLQuery:".