Getting AI to write good SQL
cloud.google.com
Getting AI to write good SQL
1–10 of 379 posts
Re: Getting AI to write good SQL
#2It's the cleanest way to give the right context and the best place to pull a human in the loop.
A human can validate and create all important metrics (e.g. what does "monthly active users" really mean) then an LLM can use that metric definition whenever asked for MAU.
With a semantic layer, you get the added benefit of writing queries in JSON instead of raw SQL. LLM's are much more consistent at writing a small JSON vs. hundreds of lines of SQL.
We[0] use cube[1] for this. It's the best open source semantic layer, but there's a couple closed source options too.
My last company wrote a post on this in 2021[2]. Looks like the acquirer stopped paying for the blog hosting, but the HN post is still up.
Re: Getting AI to write good SQL
#3> awesome-Text2SQL: https://github.com/eosphoros-ai/Awesome-Text2SQL
> Awesome-code-llm > Benchmarks > Text to SQL: https://github.com/codefuse-ai/Awesome-Code-LLM#text-to-sql
Re: Getting AI to write good SQL
#4Re: Getting AI to write good SQL
#5This is pretty simple in any foundation model, provide a well commented schema and ask for the query
Step 2...
Re: Getting AI to write good SQL
#6Re: Getting AI to write good SQL
#7Re: Getting AI to write good SQL
#8This is pretty simple in any foundation model, provide a well commented schema and ask for the query
Re: Getting AI to write good SQL
#9This is pretty simple in any foundation model, provide a well commented schema and ask for the query
Re: Getting AI to write good SQL
#10Out of all the AI tools and models I’ve tried, the most disappointing is the Gemini built into BigQuery. Despite having well named columns with good descriptions it consistently gets nowhere close to solving the problem.