Find answers from the community

Updated 12 months ago

Is there any way with text-to-sql that

At a glance

The community member is asking if there is a way to manipulate the SQL query generated by a text-to-SQL system before running it. They mention that adding a WHERE clause works sometimes, but not always.

In the comments, another community member suggests using the NLSQLRetriever component with sql_only=True as an out-of-the-box solution. Another community member provides a link to a text-to-SQL example from the Llama Index documentation, which may be helpful for building a custom solution.

The third comment indicates that the community member is interested in adding a WHERE clause based on the logged-in user, as salespeople should only have access to their own sales data in the same SQL table.

Useful resources
Is there any way with text-to-sql that once the AI creates the query, BEFORE running it to manipulate it?

i try to add to context. where clause it works but not often
j
M
3 comments
if you want an out of the box component, you can use NLSQLRetriever with sql_only=True
but you mean that i could lets say add a where clause if a specific user is logged in my streamlit app?

the problem i have is salesmen should only have access to their own sales.. so i was thinking do always add a where clause

but its the same sql table
Add a reply
Sign up and join the conversation on Discord