3 ms·
The post isn't specific to needing SQLite. Rather it's about the convenience of expressing an algorithm as a query and then using SQLite to execute the query.
by chrisaycock 3y ago
The post isn't specific to needing SQLite. Rather it's about the convenience of expressing an algorithm as a query and then using SQLite to execute the query.
I agree; queries are why table semantics are so useful. Whether you choose an SQL implementation (e.g., DuckDB and SQLite) or a dataframe library (e.g., pandas and polars), expressing searches, joins, and aggregations becomes trivial for tabular data.
- aleksiy123 3y agoI've had this thought that almost 90% of rest APIs are essentially crud that map external API to internal storage layer. With a bit of auth and validation on top. Kinda thinking a lot of rest APIs could just be SQL logic. Postgrest is pretty much like that but I wonder if you could build a more general tool. SQL + protobufs or SQL + OpenAPI schema.
- adhamsalama 3y agoSupabase?
- aleksiy123 3y agoYeah supabase is similar. But I was more thinking of allowing people to choose any db and be able to expose a rest API on top of that. Postgres, bigquery, supabase whatever. So you can quickly deploy a public facing rest API on views from that data.
- paulddraper 3y agoPostgraphile
- aleksiy123 3y agoYeah postgraphile looks cool too. But I was more thinking any database. And you still get to define/control a public REST interface.
- jd3 3y agoWe are modernizing and migrating a codebase from the 90s that was used for fec filing at the federal + state level and a majority of their business logic was expressed and written as stored procedures in mySQL.
- aleksiy123 3y agoYeah, and in general the advice is to not do that. However I had more of a slightly diff idea. More like instead of having aweb server + orm. You just write SQL for an endpoint which maps the storage data to public response. Essentially what the ORM was doing. And if the server is just managing connection and calling then endpoint query. Then packing the data to JSON response. It can just be shared/generic.
- aleksiy123 3y agoAs a reply to myself I think https://www.tinybird.co/ https://www.tinybird.co/ is pretty close to this. Except I'm not sure if they are read only or not.
- wilsonehusin 3y agoOP here, yeah it’s definitely not specific to SQLite. However, I personally don’t find it intuitive to “create database” for short-lived CLI apps because it sounds weird to have such “heavy” dependency — but this experience made me realize SQLite isn’t “heavy” at all and should probably be considered more often!
- packetlost 3y agoI imagine there are a lot of underappreciated "knockon" effects of using SQLite in this way: your data is already modeled as tables and making it persistent is dramatically easier than if you started with the traditional in-memory datastructures.