I kind of wish that there were native implementations of sqlite in every language.
I kind of wish that there were native implementations of sqlite in every language.
https://github.com/sql-js/sql.js is SQLite complied to WASM, which means you can run it not just in the browser but also in any WASM environment.
https://github.com/wasmerio/wasmer-python lets you execute WASM compiled binaries within Python.
https://github.com/wasmerio/wasmer-ruby handles Ruby.
So it should be possible to take the WASM compiled SQLite and run it in other languages.
This is a thing that really excites me about WASM: as a mainly-Python programmer it has the potential to give me access to a much wider range of tools.
Bring full SQL select, join, and order in datasette into the browser, perhaps?
- SQLite is coded in C, so performance and weight are going to be equal or better than any other reimplementation.
- Having one code base means no compatibility issue between implementations
- Also SQLite's codebase is so heavily tested and its track record is so good that I really don't see the point.
* We have a sandboxed Javascript runtime inside of the JVM that can only do restricted work. IT would be nice to be able to use something like a SQLite file to deliver configuration to this Javascript runtime
* There are environments where you cannot install any native code -- like serverless providers that require your software to be pure Java / Javascript / Python
* Cross-language debugging can be very difficult when something goes wrong
* Erlang's FFI model is either "blocking and fast" (it runs the FFI call inline, and halts preemptive multitasking), or "slow and safe" (dirty NIFs, where it runs FFI calls on a dedicated thread.) This can get really ugly, really quickly.
Not a deal-breaker; but a native implementation of sqlite in golang would be a lot nicer.
CGo-free SQLite for Linux: https://godoc.org/modernc.org/sqlite
Possibly if this was done however, we'd get native sqllite file format read/write libraries in most major languages.
Might overall be good. Sqllite-as-file-format isn't necessarily a bad idea if this infrastructure exists.
Many Small Queries Are Efficient In SQLite: https://www.sqlite.org/np1queryprob.html
Round-tripping queries via shelling out to the SQLite binary would lose much of that advantage.