2 ms·
In other words, just like when I run an SQL query myself or ask a team member to do it. The correct usage here is of course not to just run a natural language
by lxgr 2y ago
In other words, just like when I run an SQL query myself or ask a team member to do it.
The correct usage here is of course not to just run a natural language query and blindly trust the results. Sanity checking both the query and results is essential.
I still find LLMs incredibly useful in exposing new SQL functionality to me or refactoring larger existing queries to a very different approach (as SQL is unfortunately does not allow defining query components in a modular way that would let me avoid that).
- disgruntledphd2 2y ago> refactoring larger existing queries to a very different approach Huh, that's really interesting. I've found LLMs (mostly Claude) to be pretty bad at writing SQL (they love cross joins for some reason), so it's interesting that others are getting good results. What models are you using, do you do any particular prompt engineering or anything different?
- lxgr 2y agoI usually start out by pasting a simple (correct, executing) stub query in, prefacing it with "this query does <general thing I'm trying to do>", and then go step by step: "Filter for x", "now add a join to this other table <definition>" etc., and build the larger query iteratively. Another pattern I've found pretty useful: "This isn't working. Build a small sample dataset to exercise your query, and I'll paste the results back to you so we can both see what might be going wrong." Basically, I treat it as an intern, not as an oracle of truth.
- disgruntledphd2 2y agoHuh that's helpful, thanks! To be fair I mostly only need it for new dialects but my successful attempts with other tools seem to follow the same pattern.
- zcw100 2y agoI think a big difference is that people do things in predictably stupid ways and an LLM? Who knows. That could be because I've worked with stupid people my entire life and I know the boundaries of their chaos.