Nice! As an interesting test case, check out the very strange and seemingly recursive query generated for “Get the top 10 authors of caching libraries, ranked by commit volume”
Show HN: Describe SQL using natural language, and execute against real data
21–30 of 37 posts
Re: Show HN: Describe SQL using natural language, and execute against real data
#22If we could get even 50% success rate on a reasonable starting point for the generated SQL each time, that would be the biggest value-add our organization has ever seen.
I think our use case is compelling because we have to implement the same SQL targets for every customer. The only variations are typically customer-specific parameters/codes/etc.
We also have a huge corpus of examples to pull from for training data.
We are thinking about initially implementing some higher order views/functions in our SQL dialect to make things easier on ourselves with the GPT model. Complex joins across many tables seems to be something that would still elude these techniques. Most of our joins are of a very particular shape, so we can abstract the super nasty stuff away.
Worst case scenario, this concludes like my cynical mind assumes it will, but I am open to being surprised this time. We aren't going to put everything behind this, more of a "if it works..." kind of 1-2 week experiment.
Re: Show HN: Describe SQL using natural language, and execute against real data
#23Works unexpectedly well! As many others I am wondering how difficult/costly it'd be to have this assistant set up for another dataset.
Re: Show HN: Describe SQL using natural language, and execute against real data
#24Wow, this is absolutely brilliant! How can I extend this to use other datasets? There seem to be quite a few interesting publicly available datasets out there: https://console.cloud.google.com/marketplace/browse?filter=s... and I'm wondering if: 1. Is there a paid-for version of your app/website where I can plug in a diff dataset? 2. Have you considered sharing the source code for others to recreate and plug in diff…
For private datasets, we’re looking at adding that functionality to the core Tabby service (that’s the SaaS this relates to). Please email for info!
Re: Show HN: Describe SQL using natural language, and execute against real data
#25This demo sent us on a warpath today. We have a fairly clean SQL schema for which we need to craft a lot of queries that handle things like business logic, reporting and configuration. If we could get even 50% success rate on a reasonable starting point for the generated SQL each time, that would be the biggest value-add our organization has ever seen. I think our use case is compelling because we have to implement t…
Re: Show HN: Describe SQL using natural language, and execute against real data
#26Re: Show HN: Describe SQL using natural language, and execute against real data
#27 /*
Describe the data in the all_geoclustered table.
*/
SELECT
COUNT(*) AS total_rows,
COUNT(*) FILTER (WHERE date IS NOT NULL) AS total_rows_with_date,
COUNT(*) FILTER (WHERE wban IS NOT NULL) AS total_rows_with_wban,
COUNT(*) FILTER (WHERE stn IS NOT NULL) AS total_rows_with_stn,
COUNT(*) FILTER (WHERE year IS NOT NULL) AS total_rows_with_year,
COUNT(*) FILTER (WHERE mo IS NOT NULL) AS total_rows_with_mo,
COUNT(*) FILTER (WHERE da IS NOT NULL) AS total_rows_with_da,
COUNT(*) FILTER (WHERE temp IS NOT NULL) AS total_rows_with_temp,
COUNT(*) FILTER (WHERE count_temp IS NOT NULL) AS total_rows_with_count_temp,
COUNT(*) FILTER (WHERE dewp IS NOT NULL) AS total_rows_with_dewp,
COUNT(*) FILTER (WHERE count_dewp IS NOT NULL) AS total_rows_with_count_dewp,
COUNT(*) FILTER (WHERE slp IS NOT NULL) AS total_rows_with_slp,
COUNT(*) FILTER (WHERE count_slp IS NOT NULL) AS total_rows_with_count_slp,
COUNT(*) FILTER (WHERE stp IS NOT NULL) AS total_rows_with_stp,
COUNT(*) FILTER (WHERE count_stp IS NOT NULL) AS total_rows_with_count_stp,
COUNT(*) FILTER (WHERE visib IS NOT NULL) AS total_rows_with_visib,
COUNT(*) FILTER (WHERE count_visib IS NOT NULL) AS total_rows_with_count_visib,
COUNT(*) FILTER (WHERE wdsp IS NOT NULL) AS total_rows_with_wdsp,
COUNT(*) FILTER (WHERE count_wdsp IS NOT NULL) AS total_rows_with_count_wdsp,
COUNT(*) FILTER (WHERE mxpsd IS NOT NULL
/*
How often do hail and thunder happen together?
*/
SELECT
COUNT(*) AS count,
SUM(IF(hail=1 AND thunder=1, 1, 0)) AS sum_hail_thunder
FROM
`fh-bigquery.weather_gsod.all`
WHERE
year = 2019
AND mo = 11
AND da = 14
AND stn = '725030'Re: Show HN: Describe SQL using natural language, and execute against real data
#28 /*
What time of day does hail usually happen?
*/
SELECT
date,
wban,
stn,
year,
mo,
da,
temp,
count_temp,
dewp,
count_dewp,
slp,
count_slp,
stp,
count_stp,
visib,
count_visib,
wdsp,
count_wdsp,
mxpsd,
gust,
max,
flag_max,
min,
flag_min,
prcp,
flag_prcp,
sndp,
fog,
rain_drizzle,
snow_ice_pellets,
hail,
thunder,
tornado_funnel_cloud,
usaf,
name,
country,
state,
call,
lat,
lon,
elev,
begin,
end,
point_gis,
fake_date
FROM
`fh-bigquery.weather_gsod.all_geoclustered`
WHERE
hail = 1
ORDER BY
date DESC
LIMIT
10Re: Show HN: Describe SQL using natural language, and execute against real data
#29 /*
What is the range of elevations where tornadoes happen?
*/
SELECT
elev,
COUNT(*) AS count
FROM
`fh-bigquery.weather_gsod.all`
WHERE
tornado_funnel_cloud = 'T'
GROUP BY
elev
ORDER BY
count DESCRe: Show HN: Describe SQL using natural language, and execute against real data
#30May be some rough edges - or I have unreasonable expecations. The weather data set has 'begin' and 'end' columns which generates bad sql. ie, "ERROR: Syntax error: Expected end of input but got keyword END at [49:3]"
Yeah many rough edges indeed. The generated SQL is the plain output from GPT-3; I have not done anything to customize the model or validate syntax outside it, so the roughness is expected. No idea if folks will find value in this despite that, hence the demo.
I'm still amazed that I can type a natural language phrase into google and often get sensible results.