←back to thread

Getting AI to write good SQL

(cloud.google.com)
478 points richards | 6 comments | | HN request time: 0.001s | source | bottom
Show context
rectang ◴[] No.44010899[source]
> We will cover state-of-the-art [...] how we approach techniques that allows the system to offer virtually certified correct answers.

I don't need AI to generate perfect SQL, because I am never going to trust the output enough to copy/paste it — the risk of subtle semantic errors is too high, even if the code validates.

Instead, I find it helpful for AI to suggest approaches — after which I will manually craft the SQL, starting from scratch.

replies(4): >>44011204 #>>44011349 #>>44011379 #>>44011432 #
hsbauauvhabzb ◴[] No.44011379[source]
Explain that to the average manager or junior engineer, both who don’t care about your desire to build well but not fast.
replies(2): >>44011448 #>>44011772 #
1. noosphr ◴[] No.44011448[source]
> So now that we brought down prod for a day the new rule is no AI sql without three humans signing off on any queries.
replies(1): >>44011475 #
2. Closi ◴[] No.44011475[source]
If that’s the scenario, I would be asking why the testing pipeline didn’t catch this rather than why was the AI SQL wrong.
replies(3): >>44011595 #>>44011821 #>>44014227 #
3. noosphr ◴[] No.44011595[source]
Because the testing pipeline isn't the real database.

Anyone that knows a database well can bring it down with a innocent looking statement that no one else will blink at.

replies(1): >>44020014 #
4. fkyimeanit ◴[] No.44011821[source]
Because the testing pipeline was generated by AI, and code-reviewed by AI, reading a PR description generated by AI.
5. dns_snek ◴[] No.44014227[source]
To offer a 3rd option - what testing pipeline? Incompetent managers aren't going to approve of developers "wasting their time" on writing high quality tests.
6. Closi ◴[] No.44020014{3}[source]
Sure, but everyone knows humans end up bringing down the database too by writing an innocent looking test query nobody else blinks at, which is why you end up needing a testing strategy for ANY SQL before YOLO'ing into prod.