We're excited to announce a new SQLite Upload API for Turso Cloud users!
This new addition to Turso Cloud makes migrating existing databases and seeding databases significantly easier. Whether you're building a platform using the Turso Platform API, building AI agents, or just want to try out Turso with your existing databases, it's now easier than ever.
The upload is already part of the new Turso CLI db import
command, and is available through the Turso Platform API.
Before importing your SQLite database to Turso Cloud, your database should be using WAL (Write-Ahead Logging) mode:
Open your SQLite database using the SQLite command-line tool:
sqlite3 path/to/your/database.db
Set WAL to journal mode:
PRAGMA journal_mode=WAL;
Checkpoint and truncate the WAL file:
PRAGMA wal_checkpoint(TRUNCATE);
Verify the journal mode is set to WAL:
PRAGMA journal_mode;
Exit the SQLite shell:
.exit
The simplest way to import your SQLite database is through the Turso CLI:
turso db import ~/path/to/my-database.db
Your database will be named after the file (without the .db
extension), importing all your tables, data, and schema automatically. You can then connect to your newly imported database:
turso db shell <database-name>
If you want to import a database to one of yours existing groups, simply pass the group name as a parameter:
turso db import --group <group_name> ~/path/to/my-database.db
For programmatic or automated migrations, you can use the new seed type database_upload
:
Create a database ready for import:
curl -X POST "https://api.turso.tech/v1/organizations/{organizationSlug}/databases" \
-L \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "new-database",
"group": "default",
"seed": { "type": "database_upload" }
}'
Generate an authentication token for your database:
curl -X POST "https://api.turso.tech/v1/organizations/{organizationSlug}/databases/{databaseName}/auth/tokens" \
-L \
-H "Authorization: Bearer TOKEN"
Upload your SQLite database file:
curl -X POST "https://{databaseName}-{organizationSlug}.aws-{AWS_REGION}.turso.io/v1/upload" \
-H "Authorization: Bearer DATABASE_TOKEN" \
--data-binary @/path/to/your/database.db
The new upload process vastly improves data transfer efficiency. Previously, database dumps traveled to our platform API, then to an S3 bucket in us-east-2
.
Now, after a creation request to our platform API (us-east-1
), you upload directly to your database server in its native region. This means if your database is in Japan, your data uploads directly to Japan — eliminating the global round-trip and significantly reducing transfer times and latency.
The new architecture also allows larger uploads of up to 20GB, larger limits coming soon.
If you've an existing SQLite file, try out either of the methods above! Make sure to update the Turso CLI to get the new db import
command!
If you have any questions, feedback, or suggestions what you'd like to see next from Turso Cloud — Join us on Discord