←back to thread

Getting AI to write good SQL

(cloud.google.com)
477 points richards | 1 comments | | HN request time: 1.251s | source
Show context
nashashmi ◴[] No.44010349[source]
AI text to regex solutions would be incredibly handy.
replies(4): >>44010706 #>>44011846 #>>44012981 #>>44015104 #
RadiozRadioz ◴[] No.44010706[source]
This comment appears frequently and always surprises me. Do people just... not know regex? It seems so foreign to me.

It's not like it's some obscure thing, it's absolutely ubiquitous.

Relatively speaking it's not very complicated, it's widely documented, has vast learning resources, and has some of the best ROI of any DSL. It's funny to joke that it looks like line noise, but really, there is not a lot to learn to understand 90% of the expressions people actually write.

It takes far longer to tell an AI what you want than to write a regex yourself.

replies(12): >>44010769 #>>44010791 #>>44010803 #>>44010854 #>>44010941 #>>44011236 #>>44011532 #>>44011584 #>>44011591 #>>44012097 #>>44012483 #>>44013224 #
eddd-ddde ◴[] No.44010854[source]
I know regex. But I use it so sparingly that every time I need it I forgot again the character for word boundary, or the character for whitespace, or the exact incantation for negative lookahead. Is it >!? who knows.

A shortcut to type in natural language and get something I can validate in seconds is really useful.

replies(1): >>44010931 #
layer8 ◴[] No.44010931[source]
How do you validate it if you don’t know the syntax? Or are you saying that looking up syntax –> semantics is significantly quicker than semantics –> syntax? Which I don’t find to be the case. What takes time is grokking the semantics in context, which you have to do in both cases.
replies(2): >>44010966 #>>44014538 #
1. eddd-ddde ◴[] No.44014538[source]
In my case most of my regex is for utility scripts for text processing. That means that I just run the script, and if it does what I want it to do I know I'm done.

LLMs have been amazing in my experience putting together awk scripts or shell scripts in general. I've also discovered many more tools and features I wouldn't have otherwise.