Turso: Has anyone attempted running with a Turso database backend?

since Turso (https://turso.tech/) is basically just SQLight (in a hosting env) it feels like it should work but I’ve had gotchas in the past and just want to see if anyone else has already done the hard part.

This topic has been created from a Discord post (1254598356500746300) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

It would need to be supported by Knex, if it isn’t supported them them, we could never support it.

Knex supports SQLite so I guess if Turso connects the same way it should work?

thanks will let you know what I find.

I suppose it’s more accurate to say it uses libSQL (GitHub - tursodatabase/libsql: libSQL is a fork of SQLite that is both Open Source, and Open Contributions.) which is a fork of SQLite

Seems to show how to use libsql with Knex. I haven’t gotten into anything yet though.

This would be the dream

I tried with a custom dialect that knex seems to suggest but unfortunately there’s code which runs inside strapi that expects the database client property to be a string, so passing a custom knex implementation doesn’t work.

Managed to spoof sqlite3 package to be @libsql/sqlite3 but I’m running into an issue with the filename I’m passing in (for libsql://) being transformed into a file path.

This function is preventing it from working: strapi/packages/core/database/src/dialects/sqlite/index.ts at develop · strapi/strapi · GitHub

Could you please support libsql based on the GitHub - libsql/libsql-node-sqlite3: node-sqlite3 compatible API for libSQL implementation?

Namely, refactor configure to allow the url paths accepted by libsql?

Additionally it would be nice if strapi supported it more natively, such that we can pass in custom knex clients

That’s not up to us, it would have to be accepted by Knex before we could even consider it

Knex has very specific driver package requirements that we can’t change

Kinda feel like you’re passing the buck a little here ngl :confused:

We have no other choice, the way to work with Knex requires Knex to support the driver

Those are the supported clients and drivers by Knex

if it’s not in that list we can’t support it

“Can’t” as in literally cannot