Canner / WrenAI

🚀 Open-source SQL AI Agent for Text-to-SQL. Make Text2SQL Easy! 🙌
https://getwren.ai/oss
GNU Affero General Public License v3.0
1.73k stars 155 forks source link

Calculated Field names containing SQL reserved words will cause parse error #504

Open imAsterSun opened 2 months ago

imAsterSun commented 2 months ago

Describe the bug If column names or calculated field names in mdl are SQL reserved words e.g. from, it is possible that the generated SQL query causes parse error if LLM fail to add quotes around them.

To Reproduce Steps to reproduce the behavior:

  1. create a CF and name it with SQL reserved words ( for ex. create a CF named “ Select” in the orders table
  2. deploy the models
  3. ask a question “ show me the orders table details”
  4. you will see the error msg “ no relevant SQL”

Expected behavior Should inform user if SQL reserved words are not allowed, or add quote around the reserved words to prevent the issue happening.