Turso is joining Supabase to give every agent its own database Read the news →

Turso for Python.

Keep your sqlite3 code. Lose the limits.

before.pyafter.py
Turso
# before.py
import sqlite3
conn = sqlite3.connect("local.db")
cur = conn.cursor()
cur.execute("SELECT * FROM users")

# after.py
import libsql_experimental as libsql
conn = libsql.connect(
    "libsql://your-db.turso.io",
    auth_token=os.environ["TURSO_TOKEN"],
)
cur = conn.cursor()
cur.execute("SELECT * FROM users")

Without changing more than an import, you can take your sqlite3 code, point it at Turso, and get concurrent writes, embedded replication, and unlimited databases. This page shows where Turso fits and how to start.

Switching takes one import

libSQL is a fork of SQLite with a wire protocol. The Turso Python SDK implements the same Connection and Cursor interface as sqlite3, so almost any sqlite3 code works without changes.

before.pyafter.py
Turso
# before.py
import sqlite3
conn = sqlite3.connect("local.db")
cur = conn.cursor()
cur.execute("SELECT * FROM users")

# after.py
import libsql_experimental as libsql
conn = libsql.connect(
    "libsql://your-db.turso.io",
    auth_token=os.environ["TURSO_TOKEN"],
)
cur = conn.cursor()
cur.execute("SELECT * FROM users")

Where sqlite3 stops, Turso keeps going

Take all your sqlite3 code that runs on one machine. Here is what you get when you give it room.

01

Concurrent writes

Every worker can write at the same time

sqlite3 serializes writes through a single process. Turso's libSQL uses optimistic locking so multiple workers, threads, or processes can all write in parallel.

concurrent.py
Turso
import libsql_experimental as libsql

conn = libsql.connect("libsql://your-db.turso.io", auth_token=token)

# Optimistic concurrency: multiple workers write in parallel
conn.execute("""BEGIN CONCURRENT""")
conn.execute(
    """INSERT INTO events (user_id, action) VALUES (?, ?)""",
    [user_id, action],
)
conn.execute("""COMMIT""")

02

Parallel queries

Apps that keep running in parallel

libSQL supports async I/O natively, so your async Python apps don't block on database calls.

async_app.py
Turso
import asyncio
import libsql_experimental as libsql

async def fetch_user(user_id: int) -> dict:
    conn = libsql.connect(url, auth_token=token)
    cur = conn.cursor()
    await cur.execute("SELECT * FROM users WHERE id = ?", [user_id])
    return cur.fetchone()

# Run many queries in parallel without blocking
async def main():
    results = await asyncio.gather(
        fetch_user(1), fetch_user(2), fetch_user(3)
    )

03

Replication

Your database outlives the machine

Embedded replicas sync to Turso Cloud in the background. Reads hit local storage; writes propagate to the cloud replica.

replica.py
Turso
import libsql_experimental as libsql

# Embedded replica: reads hit local storage
conn = libsql.connect(
    "local-replica.db",
    sync_url="libsql://your-db.turso.io",
    auth_token=token,
)

# Pull latest writes from the cloud
conn.sync()

cur = conn.cursor()
# This read hits local disk, not the network
cur.execute("SELECT * FROM sessions")

04

Multi-tenancy

A database for every user, tenant or agent

Provision thousands of databases from a single API call. Each is isolated, lightweight, and costs only storage when idle.

tenant.py
Turso
import turso

client = turso.Client(
    org=os.environ["TURSO_ORG"],
    token=os.environ["TURSO_PLATFORM_TOKEN"],
)

# Provision a fresh database per user or tenant
db = client.databases.create(
    f"tenant-{tenant_id}",
    group="production",
    schema="tenant-template",
)

Bring SQLAlchemy and the rest of your stack

The Turso Python driver exposes a DB-API 2.0 interface, which means any library that works with sqlite3 can work with Turso with minimal changes.

SQLAlchemy

Full ORM support via the DB-API 2.0 adapter. Use SQLAlchemy Core or ORM as-is.

asyncpg/asyncio

Native async support so your FastAPI or Starlette app stays non-blocking.

Prisma

Use the Turso datasource adapter for Prisma to keep the DX you already have.

Raw SQL

Any library that accepts a sqlite3.Connection-compatible object works out of the box.

Also works with Django, Flask, SQLModel, and any DB-API 2.0 client.

“We didn't rewrite SQLite in Rust to be fancy. We wanted to support modern development needs while preserving SQLite's legendary reliability.”

Turso engineering team

Turso engineering team

Open source

libSQL is MIT-licensed and developed in the open at github.com/tursodatabase/libsql.

Ready releases

SDK releases track the libSQL release cycle. Changelogs are public.

Python 3 via pip

Works on Python 3.8+. Install with pip or uv.

Start with pip/uv

pip
Turso
pip install libsql-experimental

import libsql_experimental as libsql
conn = libsql.connect(url, auth_token=token)
uv
Turso
uv add libsql-experimental

import libsql_experimental as libsql
conn = libsql.connect(url, auth_token=token)

Questions Python developers ask first

Does Turso work with sqlite3 in-memory databases?
Yes. Pass ':memory:' as the database path and libSQL behaves identically to sqlite3 for in-memory use.
How is this different from hosting a SQLite file on S3?
Turso runs a real server that accepts concurrent connections, handles conflict resolution, and replicates data across regions. S3 is just storage.
Is it ready for production?
Turso has been in production at thousands of companies since 2023, including teams running millions of databases.
Can I use Turso with Django?
Yes. The DB-API 2.0-compatible adapter plugs into Django's database backend with a custom backend package.
Is it open source?
Yes. The Turso database engine (libSQL) is open source under MIT. Turso Cloud is the managed hosting layer.
Can I use Turso with SQLAlchemy?
Yes. Use the sqlalchemy-libsql dialect or the raw DB-API adapter. Both are documented in the Turso docs.

Install pip/uv and keep the scale you have.

100 databases free. Unlimited databases on paid plans. No schema changes required.