4 ms·
disclaimer: founder of textql.com (yea i know the name is super obvious) I would happily bet a kidney that not a single product that has an LLM of any kind wri
by ethanding 3y ago
disclaimer: founder of textql.com (yea i know the name is super obvious)
I would happily bet a kidney that not a single product that has an LLM of any kind writing SQL using next-character-prediction will ever be useful to get results for a business person in an enterprise setting (~5+ people on the data team of a company). Although it's fine for technical users as advanced autocomplete
I'm surprised no one has pointed out that as a building block: english doesn't map 1:1 to SQL at all.
"Can you get me a list of users who've ordered more than 10 red products"
doesn't make it at all clear whether you're writing
- s from u where u.ordered_more_than_10_red_products = True
- s from u where u.red_products_ordered > 10
- or any other combination of variants
15 years of VCs have poured well over 10 billion dollars claiming to solve "text to sql" of some kind and 15 year later we're still writing SQL - something something chesterton's fence... at least we don't have training sessions where data eng people sit in a room and hard code synonyms for "revenue" into thoughtspot anymore
The only way you can approach something like this at scale is w/ a mature ontology structure for your data. What that means in is a very opinionated data modeling method (handful of valid ones) that is enforced at the level of the data modeling system - dbt / sqlmesh / stored procedures, or otherwise - semantic layers are... kinda ok but mostly doesn't get there on expressiveness either
^lots of ways to do the above, small handful of cool people who are working on it. (yes that kinda includes us - sorry for the implicit self promo)
- obvious second disclaimer that if your "database" is 3 tables w/ clearly labeled joins, feel free to disregard everything I just said
- oh, also the correct query according to chatgpt is
SELECT u.user_id, COUNT(o.product_id) AS total_red_products
FROM users u
JOIN orders o ON u.user_id = o.user_id
JOIN products p ON o.product_id = p.product_id
WHERE p.color = 'red'
GROUP BY u.user_id
HAVING COUNT(o.product_id) > 10;
- obvious 4th disclaimer - if i'm wrong, i don't know what i'm talking about