3 ms·
Show HN: KSON Is JSON with SQL and Networking
- Proven 5y agoWaited 15 seconds staring at that ugly Gitlab interface. Project code didn't load (spinning wheel of death). I left.
- krapp 5y ago{ "source": <<!https://raw.githubusercontent.com/datasets/gdp/master/data/gdp.csv>> as gdp, "bot5GDPs": ```select \* from "$gdp" where year in (select max(year) from "$gdp") order by value desc limit 5;``` } https://media.giphy.com/media/vyTnNTrs3wqQ0UIvwE/giphy.gif https://media.giphy.com/media/vyTnNTrs3wqQ0UIvwE/giphy.gif It would be better to convert the SQL request to JSON on the backend, already sorted, and return the table as just data. The raw query with variables in the string gives me bad PHP flashbacks.
- tibbar 5y agoAh, but there is no inherent backend: this is a raw format, and you can “execute” it, on a backend if you like, to get a regular json document.
- krapp 5y agoOk. But why would I want to? If I already have a database with the necessary schema, I can just take the CSV file and populate it. What's the point of KSON in the middle?
- tibbar 5y agoOne (artificial) example is the second one that does a join on a csv file hosted one place and a json file hosted somewhere else. Essentially, a lot of data exploration comes down to “fetch data from these locations, transform the structure in various ways, and maybe run some sql on the result.” KSON is basically a declarative way to do that. Another in the long line of code-> data transformations.
- tibbar 5y agoGranted, though, this more of a data munging tool, and I’d be pretty scared to see this used in production.