the short answer: use a semantic layer. It'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…
A semantic layer would be great. It should be a structured layer designed to make relational queries easy to write. We could call it “structured data language” or maybe “structured query language”. In all seriousness, I have some complaints about SQL (I think LINQ’s reordering of it is a good idea), but there’s no need to invent another layer on order for LLMs to be able to wrangle it.
Getting AI to write good SQL
231–240 of 379 posts
Re: Getting AI to write good SQL
#232I understand from a technical POV how this could be considered great news. But I don't see how this is good news at all from a societal POV. The last 15 or so years has seen an unprecedented rise in salaries for engineers, especially software engineers. This has brought an interest in the profession from people who would normally not have considered SW as a profession. I think this is both good and bad. It has brough…
Im curious why there's this sentiment in regarding advances in AI. High level programming languages didnt in the least bit take away the value of the SW profession, despite allowing a vast number more people to write software. The amount and complexity of software will expand to its very outer bounds for which specialists will be required.
There are plenty of folks making a living using platforms like Salesforce and “clicks not code,” but it never led to an implosion of the SE job market. Just expanded the tech job pool. And it’s hard to imagine how that would have happened if everything needed to be coded.
Like how a growth in medical-paraprofessionals didn’t negate the need for doctors and nurses.
Re: Getting AI to write good SQL
#233Can I just say that Google AI Studio with latest Gemini is stunningly, amazingly, game changingly impressive. It leaves Claude and ChatGPT's coding looking like they are from a different century. It's hard to believe these changes are coming in factors of weeks and months. Last month i could not believe how good Claude is. Today I'm not sure how I could continue programming without Google Gemini in my toolkit. Gemini…
How do you use it exactly? Does it integrate with any IDEs?
Re: Getting AI to write good SQL
#234Earlier quoted context omitted.
> you get the added benefit of writing queries in JSON instead of raw SQL. I’m sorry, I can’t. The tail is wagging the dog. dang, can you delete my account and scrub my history? I’m serious.
LLMs are far more reliable at producing something like this: { "dimensions": [ "users.state", "users.city", "orders.status" ], "measures": [ "orders.count" ], "filters": [ { "member": "users.state", "operator": "notEquals", "values": ["us-wa"] } ], "timeDimensions": [ { "dimension": "orders.created_at", "dateRange": ["2020-01-01", "2021-01-01"] } ], "limit": 10 } than this: SELECT users.state, users.city, orders.stat…
> Please convert the following fragment of a programming language (auto-detect) into a json-like parsing information when language construct is represented like an object, fixed branches are represented like properties and iterative clauses (statement list for example) as array.
Re: Getting AI to write good SQL
#235Earlier quoted context omitted.
I also used it to "vibe write" a short story. I use it similarly to vibe coding, I give the theme and structure of the story along with the major sections and tensions and conflicts I want to express and then it filled in the words in my chosen style. I also created an editor persona and then we went back and forth between the editor and writer personas to refine the story. The Omega Directive: https://snth.prose.sh/…
My writing process is a bit different from my coding process with AI, it's more of an iterative refinement process. I tend to form the story arc in my head, and outline the major events in a timeline, and create very short summaries of important scenes, then use AI to turn those summaries into rough narrative outlines by asking me questions and then using my answers to fill in the details. Next I'll feed that abbrevi…
Re: Getting AI to write good SQL
#236Can I just say that Google AI Studio with latest Gemini is stunningly, amazingly, game changingly impressive. It leaves Claude and ChatGPT's coding looking like they are from a different century. It's hard to believe these changes are coming in factors of weeks and months. Last month i could not believe how good Claude is. Today I'm not sure how I could continue programming without Google Gemini in my toolkit. Gemini…
Re: Getting AI to write good SQL
#237This is pretty simple in any foundation model, provide a well commented schema and ask for the query
there’s two kinds of people using AI to generate SQL…those who say it’s already solved and those who say it’ll be impossible to ever solve
Re: Getting AI to write good SQL
#238In one of Stephen Boyd's lectures on convex optimization, he has some quip like "if your optimization problem is computationally intractable, you could try really hard to improve the algorithm, or you could just go on vacation for a few weeks and by the time you get back, computers will be fast enough to solve it." I feel like that's actually true now with LLMs -- if some query I write doesn't get one-shotted, I don'…
1 month to write some code with LLM, that's quite the opposite of the promised productivity gain
Re: Getting AI to write good SQL
#239Earlier quoted context omitted.
I'm really surprised more people haven't caught on. Claude can one shot small stuff of similar complexity, but as soon as you start to really push the model into longer, more involved use cases Gemini pulls way ahead. The context handling is so impressive, in addition to using it for coding agents, I use Gemini as a beta reader for a fairly long manuscript (~85k words) and it absolutely nails it, providing a high lev…
It is absolutely the greatest golden age in programming ever - all these infinitely wealthy companies spending bajillions competing on who can make the best programming companion. Apart from the apologising. It's silly when the AI apologises with ever more sincere apologies. There should be no apologies from AIs.
Re: Getting AI to write good SQL
#240Google may be getting AI to write good SQL, but they aren’t getting it to write good blog posts.