Skills2026年4月12日·1 分钟阅读

libSQL (Turso) — Open-Contribution Fork of SQLite

libSQL is a fork of SQLite that is both open source and open to contributions. Created by Turso to add features SQLite cannot: embedded replicas, server mode, vector search, and ALTER TABLE extensions. The edge database for modern apps.

Agent 就绪

先审查再安装

这个资产需要先审查。复制的指令会要求 Agent dry-run、列出写入项,确认后再继续。

Needs Confirmation · 64/100策略:需确认
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
step-1.md
先审查命令
npx -y tokrepo@latest install 290afe5f-3641-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run,确认写入项后再运行此命令。

TL;DR
libSQL extends SQLite with embedded replicas, server mode, vector search, and open-source contributions.
§01

What it is

libSQL is a fork of SQLite created by Turso that is both open source and open to contributions. SQLite itself does not accept external contributions. libSQL adds features that SQLite cannot: embedded replicas, a standalone server mode, vector search columns, and ALTER TABLE extensions.

libSQL targets developers building modern applications who want SQLite simplicity with features needed for edge computing, distributed reads, and AI workloads like vector similarity search.

§02

How it saves time or tokens

libSQL embedded replicas let your application read from a local SQLite file that automatically syncs from a remote primary. This eliminates the latency of network database queries for read-heavy workloads. The Turso CLI provides instant database creation and management without infrastructure setup.

§03

How to use

  1. Install the Turso CLI and create a database:
brew install tursodatabase/tap/turso
turso db create mydb
turso db shell mydb
  1. Or run libSQL locally with Docker:
docker run -d --name libsql -p 8080:8080 ghcr.io/tursodatabase/libsql-server:latest
  1. Connect from your application using a libSQL client library.
§04

Example

-- libSQL extends SQLite with vector columns
CREATE TABLE documents (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  title TEXT NOT NULL,
  embedding F32_BLOB(384)
);

-- Insert with vector data
INSERT INTO documents (title, embedding)
VALUES ('AI Guide', vector('[0.1, 0.2, ...]'));

-- Vector similarity search
SELECT title, vector_distance_cos(embedding, vector('[0.1, 0.2, ...]')) AS distance
FROM documents
ORDER BY distance
LIMIT 5;
§05

Related on TokRepo

§06

Common pitfalls

  • libSQL is wire-compatible with SQLite but adds extensions. Code written for libSQL vector features will not work on stock SQLite.
  • Embedded replicas are read-only. Write operations must go through the primary server.
  • The Turso managed service has a free tier with limits. Self-hosting libSQL-server removes those limits but requires your own infrastructure.

常见问题

How does libSQL differ from SQLite?+

libSQL is a fork that accepts community contributions and adds features: embedded replicas for edge sync, a standalone HTTP server mode, vector search columns (F32_BLOB), and enhanced ALTER TABLE support. It remains compatible with the SQLite file format.

What is an embedded replica?+

An embedded replica is a local SQLite file that automatically syncs from a remote libSQL primary. Your app reads from the local file (zero network latency) while writes go to the primary and replicate back.

Does libSQL support vector search?+

Yes. libSQL adds a F32_BLOB column type for storing float32 vectors and provides vector_distance_cos and vector_distance_l2 functions for similarity search directly in SQL queries.

What is the relationship between libSQL and Turso?+

Turso created libSQL as the open-source database engine and offers Turso Cloud as a managed service built on libSQL. You can use libSQL self-hosted or through Turso Cloud.

Can existing SQLite databases work with libSQL?+

Yes. libSQL reads and writes standard SQLite database files. You can open an existing SQLite database with libSQL and use it as-is. The new features are opt-in.

引用来源 (3)

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产