Show HN: Describe SQL using natural language, and execute against real data
I played around with GPT-3 to build this demo. Select a public BigQuery dataset and describe your query in natural English, then edit the generated SQL as needed and execute it.
https://app.tabbydata.com/sql-assistant-demo
36 comments
[ 3.0 ms ] story [ 76.1 ms ] threadhttps://blog.seekwell.io/gpt3
Would be happy to chat and compare notes if you'd like!
I thought it was funny in that in the weather dataset that "NULL" comes in first for the win for some questions:
> what is the all time rainiest city? > what are the top 5 most dry states?
The query conversion is impressive!
At Veezoo (http://www.veezoo.com) we have been tackling this problem for over 5 years now.
Under the hood we are using our own models. With GPT-3 we're a bit worried about the lack of fine-grained control needed for productive use-cases and obv. also lock in.
Will try out against the same dataset and see how it compares!
https://www.thoughtspot.com/everywhere
Still we have other ways of integrating it with other systems e.g. exporting to CRMs. Also on the branding side it's possible to have it in the companies corporate identity.
And just let me know if you wanna get a quick tour, happy to show you around :)!
ie, "ERROR: Syntax error: Expected end of input but got keyword END at [49:3]"
I'm still amazed that I can type a natural language phrase into google and often get sensible results.
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 datasets? 3. Or, :sweat_smile:, perhaps this is as simple as adding new datasets to the drop-down menu? say, finance data / Bitcoin transactions data?
Regardless, really cool app!
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!
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”
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 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.
Possibly relevant: https://yale-lily.github.io/spider
I briefly worked on a startup to commercialize this tech, but we decided it wasn't accurate enough to be useful. It was very cool when it actually worked. If you can only produce what you want half the time on simple queries, that doesn't seem very useful to me though.
The success rate was just not good enough, even for relatively simple queries. You'd probably need to adjust the query 90% of the time, and the other 10% you couldn't even really trust that the answer was correct.
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 lat IS NOT NULL AND lon IS NOT NULL AND lat != 0 AND lon != 0 AND lat != 1 AND lon != 1 AND lat != -1 AND lon != -1 AND lat != 2 AND lon != 2 AND lat != -2 AND lon != -2 AND lat != 3 AND lon != 3 AND lat != -3 AND lon != -3 AND lat != 4 AND lon != 4 AND lat != -4 AND lon != -4 AND lat != 5 AND lon != 5 AND lat != -5 AND lon != -5 AND lat != 6 AND lon != 6 AND lat != -6 AND lon != -6 AND lat != 7 AND lon != 7 AND lat != -7 AND lon != -7 AND lat != 8 AND lon != 8 AND lat != -8 AND lon