turso Python package provides a PEP 249 DB-API 2.0 compatible interface, closely mirroring the built-in sqlite3 module.
Installation
DB-API 2.0 module attributes
| Attribute | Value | Meaning |
|---|---|---|
turso.apilevel | "2.0" | Implements DB-API 2.0 |
turso.threadsafety | 1 | The module is thread-safe; connections are not |
turso.paramstyle | "qmark" | Positional ? placeholders |
Quick start
In-memory database
Pass":memory:" to open a transient in-memory database:
Context manager
Connection implements the context manager protocol. A successful block commits; an exception rolls back:
Pages in this section
Connection
Open a database, commit or roll back transactions, and run ad-hoc SQL.
Cursor
Execute statements, bind parameters, and fetch result rows.