Hasura Turso Connector
The Hasura Turso Connector allows for connecting to a LibSQL/SQLite database or a Turso hosted LibSQL database to give you an instant GraphQL API on top of your Turso data.
This connector is built using the Typescript Data Connector SDK and implements the Data Connector Spec.
Features
Below, you'll find a matrix of all supported features for the Turso connector:
Feature | Supported | Notes |
---|---|---|
Native Queries + Logical Models | ❌ | |
Simple Object Query | ✅ | |
Filter / Search | ✅ | |
Simple Aggregation | ❌ | |
Sort | ✅ | |
Paginate | ✅ | |
Table Relationships | ✅ | |
Views | ❌ | |
Distinct | ❌ | |
Remote Relationships | ✅ | |
Custom Fields | ❌ | |
Mutations | ✅ |
Prerequisites
- Create a Hasura Cloud account
- Please ensure you have the DDN CLI and Docker installed
- Create a supergraph
- Create a subgraph
The steps below explain how to initialize and configure a connector on your local machine (typically for development purposes).You can learn how to deploy a connector to Hasura DDN — after it's been configured — here.
Using the Turso connector
With the context set for an existing subgraph, initialize the connector:
ddn connector init -i
When the wizard runs, you'll be prompted to enter the following env vars necessary for your connector to function:
Name | Description |
---|---|
TURSO_URL | The connection string for the Turso database, or the file path to the SQLite file |
TURSO_AUTH_TOKEN | The turso auth token |
If you are attaching to a local SQLite file, first make sure that the file is located inside the connector directory.
For example, if you had a data.sqlite
file you could place it at /app/connector/turso/data.sqlite
. Files in the
connector directory get mounted to /etc/connector/
.
In this instance, you would set the TURSO_URL=file:/etc/connector/data.sqlite
and leave the TURSO_AUTH_TOKEN
as
blank/null.
Your experience mounting files may vary, and while useful to explore a file locally, it's not recommended to attempt to deploy a connector using a locally mounted file.
After the CLI initializes the connector, you'll need to:
- Introspect the source.
- Add your models, commands, and relationships.
- Create a new build.
- Test it by running your project along with the connector.
Documentation
View the full documentation for the Turso connector here.
Contributing
Check out our contributing guide for more details.
License
The Turso connector is available under the Apache License 2.0.