Databases for Android multi-tenant AI Apps.
Turso · Docs · Quickstart · SDK Reference · Blog & Tutorials
- 🔌 Works offline with Embedded Replicas
- 🌎 Works with remote Turso databases
- ✨ Works with Turso AI & Vector Search
Warning
This SDK is currently in technical preview. Join us in Discord to report any issues.
Add libsql
to your Gradle dependencies:
dependencies {
implementation("tech.turso.libsql:libsql:0.1.0")
}
Note
This will only work with the Android Gradle Plugin for now.
The example below uses Embedded Replicas and syncs data every 1000ms from Turso.
import tech.turso.libsql.Libsql
val db = Libsql.open(
path = "./local.db",
url = "TURSO_DATABASE_URL",,
authToken = "TURSO_AUTH_TOKEN",
syncInterval: 1000
)
val conn = db.connect()
db.connect().use {
it.execute_batch("
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT
);
INSERT INTO users (name) VALUES ('Iku');
")
}
db.connect().use {
it.query("SELECT * FROM users WHERE id = ?", 1)
}
Visit our official documentation.
Join us on Discord to get help using this SDK. Report security issues via email.
See the contributing guide to learn how to get involved.