How to use Turso locally: SQLite compatibility, CLI, Rust, Node, and Python examples

A practical guide to tursodatabase/turso local database usage: install the CLI, create a table, insert and query data, and connect from Rust, Node.js, Python, and Go.

tursodatabase/turso is an in-process SQL database compatible with SQLite. In simple terms, it tries to keep SQLite’s lightweight, embedded experience while turning it into a database tool that fits modern applications and multi-language SDKs better.

Project repository:

https://github.com/tursodatabase/turso

Install the CLI

The README installs the latest release installer like this:

1
2
curl --proto '=https' --tlsv1.2 -LsSf \
  https://github.com/tursodatabase/turso/releases/latest/download/turso_cli-installer.sh | sh

After installation, enter the CLI:

1
tursodb

You will see a prompt similar to:

1
2
3
4
Turso
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database

Try a Table First

You can run SQL directly in the CLI:

1
2
3
4
CREATE TABLE users (id INT, username TEXT);
INSERT INTO users VALUES (1, 'alice');
INSERT INTO users VALUES (2, 'bob');
SELECT * FROM users;

Output:

1
2
1|alice
2|bob

If you only want to verify syntax and compatibility, this step is enough. Connect it to an application after that.

Run from Source

Developers can run it directly inside the repository:

1
cargo run

The README also provides Docker commands:

1
2
make docker-cli-build && \
make docker-cli-run

Connect from Applications

For Rust projects, add the dependency:

1
cargo add turso

For Node.js projects:

1
npm i @tursodatabase/database

For Python projects:

1
uv pip install pyturso

For Go projects:

1
go install turso.tech/database/tursogo

Suitable Use Cases

Turso fits these scenarios:

  1. You want a SQLite-style database with more modern multi-language SDK support.
  2. Local apps, CLI tools, or desktop apps need embedded SQL.
  3. A prototype project does not want to deploy a database service first.
  4. You want to test SQLite-compatible options and the Rust database ecosystem.

If you need a full distributed database, complex permission management, and large-team operations, evaluate the boundaries first. Turso is better viewed as a lightweight database entry point, not a tool that solves every database problem at once.

记录并分享
Built with Hugo
Theme Stack designed by Jimmy