I think the solution to both of these questions is providing additional descriptions of the table
When the text2sql conversion happens, all the LLM reads is the schema of the db and the user query
In addition to the automatic schema of each query, you can provide extra descriptions of each table (and these descriptions can also include instructions!)
See the table context dict in this section
https://gpt-index.readthedocs.io/en/latest/guides/tutorials/sql_guide.html#injecting-contextSide note, there isn't really any checking before executing a query, at least by default. But we are working on a microsoft guidance integration that may be able to improve text2sql queries