Find answers from the community

Updated 3 months ago

llama_index/llama_index/indices/struct_s...

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:".
L
R
15 comments
hmmm what version of llama-index do you have? That looks like an older bug from a few weeks ago
Got the same thing happening now with 0.7.11
Plain Text
DEBUG:llama_index.indices.struct_store.sql_query:> Predicted SQL query: SQLQuery: SELECT id...
hmmm could have sworn this got fixed. Will check with the guy responsible for that fix haha
FWIW this problem has only happened since using ReActAgent \ QueryEngineTool wrapped SQLTableRetrieverQueryEngine
Scratch that - I've just switched back to querying SQLTableRetrieverQueryEngine directly and the same thing is happening
Also mb realised the _parse_response_to_sql method doesn't do what I thought it did... I thought it stripped anything before and including the string SQLResult. Actually it retains anything preceding that string.
Searching the repo for the string "SQLQuery:" comes up blank
The github search is really bad, that string is in the repo πŸ˜…
is this function bugged?
I don't think so. This the SQLQuery: string is maybe stripped somewhere else
But tbh I'm trying Snowflake first as been having issues with BigQuery and want to see if Snowflake will less troublesome
I just have a checkout of the code and do ctrl-shift-f, much better πŸ’ͺ
Add a reply
Sign up and join the conversation on Discord