News for hackers. Stuff that matters.
Re:SQL is a better API language than GraphQL – Convince me o... by zozbot234 on Thursday April 16, 2020 @07:52PM (#22894806)
What if the "views" your API queries didn't have to be tables? You could just keep "tables" as a backend implementation detail, and 'fake' a different model on top of them that's closer to what the client needs.
Re:SQL is a better API language than GraphQL – Convince me o... by enobrev on Thursday April 16, 2020 @08:44PM (#22895137)
I think what's becoming clear in this discussion is that there are some developers (myself definitely included) who would like to use SQL as an interface to plain programming structures outside of actual databases.

I understand postgres provides something like this, but it would be interesting as a library rather than a separate application. I'd love to be able to query hashmaps or arrays of data using SQL.

Maybe this already exists somewhere? My web-search-fu is failing me but I recall reading somewhere that facebook had something like this for querying systems, so maybe such a library exists extracted from that usecase?

Edit: Here's one. https://github.com/mozilla/moz-sql-parser

Re:SQL is a better API language than GraphQL – Convince me o... by enhray on Thursday April 16, 2020 @10:04PM (#22895552)
SQLite has “virtual tables” feature [0] which was designed exactly for this use-case.

Edit: and that Facebook project is called OsQuery [1]. It was built on top of SQLite virtual tables and is listed in their implementations list.

[0] https://www.sqlite.org/vtab.html

[1] https://osquery.readthedocs.io/en/stable/

Re:SQL is a better API language than GraphQL – Convince me o... by TeMPOraL on Friday April 17, 2020 @02:52AM (#22896813)
> I think what's becoming clear in this discussion is that there are some developers (myself definitely included) who would like to use SQL as an interface to plain programming structures outside of actual databases.

Myself included too. As a side project, I'm currently writing a game (roguelike), where all the game state that would ordinarily be put into an ECS or an object tree is instead stored in in-memory SQLite instance; the game's state management consists of (currently hand-written) SQL queries.

The reason for that is because, in trying to implement yet another version of an ECS-like architecture, I realize I'm essentially reinventing database queries and database indices, so I might as well use the real thing.

Re:SQL is a better API language than GraphQL – Convince me o... by elcritch on Friday April 17, 2020 @12:41AM (#22896252)
Re:SQL is a better API language than GraphQL – Convince me o... by touisteur on Friday April 17, 2020 @07:24PM (#22903956)
For Postgres you mean foreign data wrappers ? Or storing plain (mmappable?) binary data in bytea and creating a pg extension to serialize/deserialize? I'm working on both...
Re:SQL is a better API language than GraphQL – Convince me o... by andy_ppp on Thursday April 16, 2020 @08:03PM (#22894881)
Amazing you mean some sort of intermediate data transfer language that could resolve requests into SQL in the server side! Genius!