My Authors
Read all threads
SQL is a better API language than GraphQL. Convince me otherwise!
To counter some obvious arguments...

You don't have to expose your entire schema, instead expose carefully designed SQL views (so you can refactor your tables without breaking your API)

Read-only, obviously!

Use time limits to cut off expensive queries (GraphQL needs this too)
(I haven't quite convinced myself yet that SQL is a great language for update APIs, but I'm working on it)
This thread partly inspired by comparing my SQL-based Covid-19 data API with some GraphQL equivalents covid-19.datasettes.com/covid.json?sql…
Fun story: I wrote a documentation search engine for work that constructed SQL statements /in client-side JavaScript/ and sent them to Datasette.

I genuinely did this as a joke, to wind up other developers with network tools traces.

But it worked great! Fast, maintainable, fun.
And it had "facet by emoji" which worked by constructing SQL statements in JavaScript with emoji characters in them and the sending them over HTTP. Those network panel requests were particularly delightful.
In further emoji-in-your-SQL news, I use the 🐺 emoji every time I checkin with @Cleopaws on Swarm, so now I can plot her favourite places on a map with a SQL query! (using github.com/dogsheep/swarm…)
Some good discussion on the benefits of GraphQL compared to SQL in this conversation two years ago:
I think this mini-thread is the best response so far
Oh crikey this ended up on Hacker News news.ycombinator.com/item?id=228929…
Here's a tutorial I wrote about using SQL in client-side JavaScript for @24ways in December 2018 24ways.org/2018/fast-auto…
And if SQL-in-your-JavaScript isn't enough for you, how about some jq-in-your-SQL-in-your-JavaScript: github.com/simonw/dataset…
Missing some Tweet in this thread? You can try to force a refresh.

Enjoying this thread?

Keep Current with Simon Willison

Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Follow Us on Twitter!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!