Hi @mycelia,
the main motivation is to enable running wasi-oriented projects (such as sqlite) in a canister. Since WASI is not supported directly by IC, the project helps to transform Wasm binaries. You can check out the introduction here and the project here.
@ulan thank you for that explanation.
icpp-pro
does not enable writing to stable memory directly, so we should be good then.
I will add it to the docs though, to warn people not to implement something themselves to write to stable memory, and just use the standard file system.
@sgaflv Amazing work! I managed to make your examples/ic-rusqlite work!
So, now weāre missing a good ORM that enables people to manage their database inside the canister, in order to onboard even more of the people that are used to traditional databases.
Iāve found this old rusqlite-model implementation, which could act as reference to build a good ORM.
Iād love to see libraries like SQLx to support wasm32-wasi
, but it looks like itās not that easy for them to add support for that target.
Furthermore, I also envision a future in which there will be a CLI tool that manages the canisterās db migrations.
What do you think? Should we spend time investigating the efforts needed to build a good ORM on the IC?
Is this the direction we should take to spread the adoption of canisters?
First off, I think we should compile a version of sqlite with some sensible default settings to a wasm module and package it in a crate. A canister dev that wants to use SQLite should not have to setup clang etc.
For SQLx, did you have a look at the wasi version?
Definitely agree, but this should be part of a plug and play CDK (C for Canister, as we are used to)/ORM that helps you to maintain the db inside the canister. I guess no one (and for āno oneā I mean medium to big projects) would like to write migrations and queries in raw SQL manually.
I was looking at the work done by WasmEdge and it looks great. I see a lot of points in common with the Internet Computer that we should explore, especially when they talk about things like Serverless SaaS Functions, for which the IC is the perfect match in my opinion.
Unfortunately, it doesnāt look like sqlx_wasi
is maintained anymore (last release 2 years ago).
Looks like sqlite-web-rs is moving in the direction of creating an ORM for Wasm runtimes.
Currently, the library targets wasm32-unknown-unknown
and can run inside browsers.
Would Limbo be a good fit for this scenario? It appears to be a Rust-based reimplementation of SQLite, designed with a strong focus on wasm.
This is an interesting alternative to Sqlite, you only need to compile Rust to run it. It seems to be in its relatively early development stage (lots of missing features: no ROLLBACK support, didnāt manage to use parameters with the queries, ā¦), but it is usable already! Iāve added an extra example that you can experiment with: https://github.com/wasm-forge/examples/tree/main/ic-limbo.
Oh, great @sgaflv! Have wanted to take a closer look at limbo for a long time. I would suspect they will push forward fairly quickly with the development, I heard the Turso founder on some podcast, he seemed focused on making it production ready.
@ilbert, if limbo is sqlite compatible, then sqlite-web might be able to use it. That would be a nice combo!
PR with a couple small changes I had to make to get the limbo example running
Great! Thank you for the update!
Azleās experimental mode already has support for SQLite and the Drizzle and TypeORM ORMs: Databases - The Azle Book
Once we release 1.0, we would like to finish our support for Azleās ability to execute Wasm modules, which would allow us to run different versions of SQLite (rather than just SQL.js) and pglite.