3 ms·
This is the problem with using AI for generating SQL statements; it doesn't know the semantics of the your database schema. If you are still open for a solution
by l5870uoo9y 3y ago
This is the problem with using AI for generating SQL statements; it doesn't know the semantics of the your database schema. If you are still open for a solution, I recently deployed a solution[1] that combines AI, db schema and simple way train AI to know your database schema.
Essentially, you "like" correct (or manually corrected) generations and a vectorized version is stored and used in future similar generations. An example could be tell which table or foreign key is preferred for a specific query or that is should wrap columns in quotes.
From my preliminary tests it works well. I was able to consistently make it use correct tables, foreign keys and quotes on table/column name for case-sensitivity using only a couple of trainings. Will open a public API for that soon too.
[1]: https://www.sqlai.ai/ https://www.sqlai.ai/
- tilwidnk 3y agoIt's "a public API", not "an public API", because of the consonant rule. I really worry that there are people out there who will anxiously mangle their company's data thinking what is being called AI, which doesn't exist yet, will save the day.
- l5870uoo9y 3y agoUse it as a tool not a replacement. However it does do things well even without much additional information like fixing SQL statement[1]. That being said it is consistently improving, GPT-3.5 to GPT-4 was a major upgrade. [1]: https://www.sqlai.ai/snippets/clroq0qn9001xqzqeidtm4jgx https://www.sqlai.ai/snippets/clroq0qn9001xqzqeidtm4jgx
- CrimsonRain 3y agoJust copy paste the db/table schema in a comment at start of your file. Nothing else needed.