mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-12-23 08:21:09 +00:00
| .. | ||
| src | ||
| tests | ||
| turso | ||
| build.rs | ||
| Cargo.toml | ||
| example.py | ||
| py-bindings-db-aio.mdx | ||
| py-bindings-db.mdx | ||
| py-bindings-sync-aio.mdx | ||
| py-bindings-sync.mdx | ||
| py-bindings-tests-aio.mdx | ||
| py-bindings-tests.mdx | ||
| pyproject.toml | ||
| README.md | ||
| requirements-dev.txt | ||
| requirements.txt | ||
Turso Database for Python
About
⚠️ Warning: This software is in BETA. It may still contain bugs and unexpected behavior. Use caution with production data and ensure you have backups.
Features
- SQLite compatible: SQLite query language and file format support (status).
- In-process: No network overhead, runs directly in your Python process
- Cross-platform: Supports Linux, macOS, Windows
Installation
uv pip install pyturso
Getting Started
import turso
# Create/open a database
# con = turso.connect(":memory:") # For memory mode
con = turso.connect("sqlite.db")
cur = con.cursor()
# Create a table
cur.execute("""
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT NOT NULL
)
""")
con.commit()
# Insert data
cur.execute("INSERT INTO users (username) VALUES (?)", ("alice",))
cur.execute("INSERT INTO users (username) VALUES (?)", ("bob",))
con.commit()
# Query data
res = cur.execute("SELECT * FROM users")
users = res.fetchall()
print(users)
# Output: [(1, 'alice'), (2, 'bob')]
License
This project is licensed under the MIT license.