-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add libSQL support to SQLite generator #304
Comments
I'll look into this |
Thanks @stephenafamo ! I'm willing to work on this as well if you give me some direction as to how you'd want this configurable. The way most projects do this is by supporting various connection strings for SQLite, things like Perhaps something like this: sqlite:
dsn: 'libsql://my-libsql-url' And perhaps if it does not contain a scheme or the scheme is sqlite:
dsn: "schema.sqlite" sqlite:
dsn: "file://schema.sqlite" |
This would be a good way to do it. The other concerns would be
|
Another thing I have just noticed. The current sqlite driver supports attaching databases, and the existing test tries to do this. |
Yeah, we don't currently use ATTACH, but that could be a use case to watch out for. Because of the way you've structured config for ATTACH in the generator, I don't think that will be much of a hurdle. You can also operate a full sqld server (the actual server component of LibSQL) locally or in CI using Docker. I would imagine this would be as easy to spin up and seed with data for testing as PostgreSQL and other database engines currently being tested. Here's a minimal Docker compose to spin up a sqld instance for your reference: services:
sqld:
image: ghcr.io/tursodatabase/libsql-server:v0.24.27
environment:
- SQLD_NODE=primary
- SQLD_ADMIN_LISTEN_ADDR=0.0.0.0:8082
ports:
- "8080:8080"
- "8082:8082"
command:
- "/bin/sqld"
- --enable-namespaces
- --disable-default-namespace
- --enable-http-console From there, you can create databases for testing like so:
The connection string for that database would roughly be:
Creating a second database, you could attach the above database using ATTACH.
Does that help you understand how this could be tested? Instead of providing a file path, you provide the other database ID to attach to. The database ID in sqld is the namespace. You'd need to have both databases created before attempting to test and any necessary schemas applied as well. Let me know if anything isn't clear, I'm happy to provide more context. |
|
This is great... I think this should be fairly straightforward then.
|
In v0.29.0 you removed support for Atlas, which was allowing us to use Bob with libSQL/Turso (a database not directly supported by Bob). Since Bob is now focused on each database implementation, rather than schema tooling, supporting libSQL would allow us to use the generator directly on our database. To get around the removal in v0.29.0 we have to export our schema from libSQL to a local file to be read by Bob, which works, but adds unnecessary steps to generating code.
The libSQL project is a fork of SQLite, so nothing aside from the driver should need to change to support libSQL. The dialects are identical from a schema perspective.
The text was updated successfully, but these errors were encountered: