Live data from Hacker News

Text-to-SQL is dead, long live text-to-SQL

exasol.com

21–30 of 52 posts

Re: Text-to-SQL is dead, long live text-to-SQL

#21

What is the human need to bash SQL at all costs? At its core, such a simple syntax, yet its so powerful at aggregating/manipulating tabular data and the like. Instead we’d rather declaratively say what we want in a more verbose/disjointed way… fascinating

For me SQL feels like PHP. Sure it's usable, but it doesn't spark joy. Syntactically PRQL is much simpler, cleaner and more flexible. You simply chain pipeline stages instead of having a single monolithic query statement. Data model wise EdgeQL is close to what I want (links instead of joins, optionality instead of null, nesting support), but it's syntax is almost as bad as SQL.

Oh man, PRQL looks so good.

I just wish they had mutation in there too. I don't like the idea of swapping between PRQL and SQL, let alone some complex update statements where i'd rather write the query in PRQL. .. Yea you could argue they shouldn't be that complex for updates though heh.

Re: Text-to-SQL is dead, long live text-to-SQL

#22
aren't programming languages like SQL designed to strike a quasi-optimal balance between precision and economy? that is to say, if I want to use plain English to specify some kind of data operations, the prompt will necessarily be more verbose and/or less specific than SQL statements. So why not just learn SQL properly? And then learn the domain-specific considerations of the source data as well as the domain-specific business requirements? Or am I missing something essential?

Re: Text-to-SQL is dead, long live text-to-SQL

#23
post #22

aren't programming languages like SQL designed to strike a quasi-optimal balance between precision and economy? that is to say, if I want to use plain English to specify some kind of data operations, the prompt will necessarily be more verbose and/or less specific than SQL statements. So why not just learn SQL properly? And then learn the domain-specific considerations of the source data as well as the domain-specifi…

Yes you are. I can show you 15 line SQL queries you would be hard pressed to understand, let alone built with precision as a novice

And you want everyone to learn this? People who don’t even have time or ability to master excel?

Really?

Re: Text-to-SQL is dead, long live text-to-SQL

#24
post #22

aren't programming languages like SQL designed to strike a quasi-optimal balance between precision and economy? that is to say, if I want to use plain English to specify some kind of data operations, the prompt will necessarily be more verbose and/or less specific than SQL statements. So why not just learn SQL properly? And then learn the domain-specific considerations of the source data as well as the domain-specifi…

For all it's flaws, I certainly prefer SQL to something like XQuery.

Re: Text-to-SQL is dead, long live text-to-SQL

#25
post #23
post #22

aren't programming languages like SQL designed to strike a quasi-optimal balance between precision and economy? that is to say, if I want to use plain English to specify some kind of data operations, the prompt will necessarily be more verbose and/or less specific than SQL statements. So why not just learn SQL properly? And then learn the domain-specific considerations of the source data as well as the domain-specifi…

Yes you are. I can show you 15 line SQL queries you would be hard pressed to understand, let alone built with precision as a novice And you want everyone to learn this? People who don’t even have time or ability to master excel? Really?

It's hard because relational algebra is hard. It's hard because it's easy to write a query that returns arbitrary data, but it's hard to write a query that returns only the correct data that you really want.

The problem is that, IMX, AI is just as shit at that as most humans are. AI can find and connect primary keys and columns with the same name. It doesn't understand cardinality of entities or how to look for data that breaks the data model of the application (which is a critical element of data validation).

None of the actual hard parts of writing SQL go away with AI.

Re: Text-to-SQL is dead, long live text-to-SQL

#26
The original idea idea behind SQL was to create a language that looked like English and allowed regular users to express their queries in something that resembled natur Al language. Naturally it has evolved into something far more complex, but maybe today with LLMs it can get back to its origin,

LLMs are getting pretty good at writing SQL. There is so much training material out there, and it is not that hard to validate the results. The real interesting question will be if they will be better at leveraging all the database specific dialects than tool like PowerBI. High-performance databases like Exasol often has a lot of specific features in their SQL dialects that generic tools and ORMs are not able to use, it will be interesting to see if LLMs can make that more accessible.

Re: Text-to-SQL is dead, long live text-to-SQL

#27
post #19

Earlier quoted context omitted.

I've always found it odd that most databases don't expose a kind of query bytecode API that SQL can be converted to. It would allow more kinds of languages, different SQL dialects, compile-time optimizations, and perhaps ORM could be compiled directly into your target database spec. Would reduce the amount of string operations by client code, at least

For translation between dialects, you could use projects such as SQLGlot. The advantage of SQL is the standardization over many decades (yes, I know that it's still a mess with the different dialects).

SQLGlot is amazing. In many ways it helps erase the differences and bridge between dialects. It is so useful for moving complex queries between platforms.

Re: Text-to-SQL is dead, long live text-to-SQL

#28

But SQL is text, that's the whole point of it. Sure, you have to phrase your question in a way that's a bit like trying to ask a very specific question of an annoying "Self-Diagnosed Internet Autistic" co-worker who can't tell the difference between being "precise" and being "a pedantic pain in the arse", but it is just text. Oh you're upset because SQL isn't in German? Well there's no reason why you can't stick Germ…

Well, of course you're correct that SQL is text, but that's not what the article is arguing about. The point isn't whether SQL is text... it's about the kind of text it is.

SQL is a formal language, not a natural one. It's precise, rigid, and requires a specialized understanding of schema, joins, and logic. text-to-sql systems don't exist because people are too lazy to type; they exist because most people can't fluently express analytical intent in sql syntax. They can describe what they want in natural language ("show me all active users who registerd this year"), but translating that into correct, optimized sql requires at least familiarity, and sometimes expertise

So the governance challenges discussed in the article aren't about "oh SQL is too hard to type"...they're about trust, validation, and control when you introduce an AI intermediary that converts natural lang into a query that might affect sensitive data

Re: Text-to-SQL is dead, long live text-to-SQL

#30
post #9
post #4

Long term, SQL will be phased out for new LLM-friendly query languages. The cost of AI generating tens of billions of queries per day creates a new incentive for rationality and efficiency that overcomes the human institutional weight of legacy languages. I'm working on such a language now: https://memelang.net/

If history is any indication, you've got it backwards: it's more likely that LLMs will be phased out for SQL.

What history are you considering?
Post reply on HN