Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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



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/


> 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.



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...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: