Roapi: An API Server for Static Datasets
tech.marksblogg.com
tech.marksblogg.com
Sorry if it's a dumb question but I skimmed the docs and sample and it looks similar + didn't see any mention:
From a technical design point of view, ROAPI authors owns the full stack end to end from query parsing, data format parsing to query execution because I am also a maintainer of Apache arrow and it's sub-project datafusion. The whole project is built with Rust end to end from scratch. Datasette is mostly a wrapper around sqlite. It translates user actions into SQL queries, then execute them on sqlite. In ROAPI, we work at a lower level. We translate REST APIs, GraphQL and SQLs into datafusion logical plans and execute them. Datafusion is also a analytical compute engine optimized for columnar data, so it will be a lot faster for OLAP workload, while sqlite is optimized for OLTP. I also plan to add other type of query capabilities like nearest neighbor vector search for ML applications, etc.
I'm not in the Data Science space so I only know of Datasette, but maybe worth copy-pasting that on a FAQ page under "How does ROAPI compare to X?" to avoid repeating it.
It does take a few more commands to start a ClickHouse server, create table and load data in... a friendly loader program could probably get pretty close to Roapi interface.
Both Roapi and Datafusion look very cool! Excited to learn about them.
You can load data into MergeTree table that support streaming data ingestion or into Memory table (that is read/write as well).
Also you can run queries on the data without any preprocessing (with `file`, `url` table functions or similar).
See also https://clickhouse.com/docs/en/operations/utilities/clickhou...
https://docs.datasette.io/en/stable/ecosystem.html#sqlite-utils
"Insert data into a SQLite database from JSON, CSV or TSV, automatically creating tables with the correct schema or altering existing tables to add missing columns."There's a bunch of plugins (mix of official and user-developed) that might add other formats too, I'm not 100% sure:
If you need a simple version of this, Hugo is a great and well proven option. Push onto your CDN of choice and you’ve got a blazing fast static json api.
I fail to see how this method is not "simple enough"
Does Roapi needs to load the data file into memory first, and then answer the queries? Or does it handle the query while streaming through the data?
"ROAPI is made up of 4K lines of Rust. This line count is low due to the intense use of 3rd party libraries."
This actually seems like a high line count, and that's not counting all the 3rd party libraries.
While not sexy, this is the sort of thing that PHP can do fairly easily in a much smaller # of lines of code and operate with lower resource requirements. I venture that this could be done using CSV parse, json decode, and other built-in PHP functions and use small infrastructure to make it work. I know PHP doesn't have a lot of love, but isn't this the sort of thing PHP is made for? Simple processing and hosting for API-based access to static file information? Is there a reason why Rust is needed with all the baggage?
Also, there's no need to write any code here, it's a CLI app. There's much less that could go wrong versus rolling your own.
But if you assume JIT, you can also compile queries into native code on the fly. That should at the very least offset some of the difference.
Here's a project which in part is built to fulfill a similar need: https://github.com/tobgu/qocache (I'm the author). Most of the background/rationale for it and example usage can be found in the README of the original QCache project, linked from the above repo.
There are of course big differences between the projects but I find that they share the same goal of making random, file based, datasets easily accessible for querying.
I'll definitely let myself be inspired by Roapi, thanks!
I checked the code. Is it loading data as "map[string]*list.Element"?
Yes, in the abstract sense, which I guess you mean. QFrame (https://github.com/tobgu/qframe), the underlying dataframe used, is column oriented.