Install & Compatibility
Where this runs
tested against v2.0.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.2MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 2.4s · import 0.000s · 20MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SQL
✓ from sqlite3_api import SQL
The primary class for database interaction in this wrapper library.
This quickstart demonstrates how to establish a connection, create a table, insert, query, and update data using the `sqlite3-api` wrapper. It emphasizes explicit commit/rollback for transaction management and closing the connection.
import os
from sqlite3_api import SQL
# Create an in-memory database (for a file-based DB, use 'my_database.db')
db_path = ':memory:'
conn = SQL(db_path)
try:
# Create a table
conn.execute("CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)")
# Insert data
conn.execute("INSERT INTO users (name) VALUES (?)", ("Alice",))
conn.execute("INSERT INTO users (name) VALUES (?)", ("Bob",))
conn.commit() # Explicitly commit changes
# Query data
print("--- All Users ---")
results = conn.query("SELECT * FROM users")
for row in results:
print(row)
# Update data
conn.execute("UPDATE users SET name = ? WHERE id = ?", ("Charlie", 1))
conn.commit() # Explicitly commit changes
# Verify update
print("\n--- Updated User 1 ---")
updated_user = conn.query("SELECT name FROM users WHERE id = 1")
for row in updated_user:
print(row)
except Exception as e:
print(f"An error occurred: {e}")
conn.rollback() # Rollback on error
finally:
conn.close() # Always close the connection
Debug
Known issues
gotchaThe `sqlite3-api` PyPI package is a separate, third-party wrapper, not the built-in `sqlite3` module that ships with Python. Most Python users interacting with SQLite should use the standard library's `sqlite3` module, which is actively maintained and fully DB-API 2.0 compliant.fixFor direct SQLite access without external dependencies, use `import sqlite3`. If a higher-level ORM or wrapper is desired, consider more widely adopted and actively maintained alternatives.
affects: All
deprecatedThe `sqlite3-api` package appears to be minimally maintained, with its last release in November 2021. Users seeking active development, community support, or robust features should consider Python's built-in `sqlite3` module or other actively maintained database access layers.fixEvaluate whether the built-in `sqlite3` module or another maintained library (e.g., SQLAlchemy for ORM, or a more recent, community-supported wrapper) better suits your project's needs.
affects: 2.0.4 and potentially earlier
gotchaWhile the `sqlite3-api` wrapper might abstract some cursor management, explicit transaction control (e.g., `conn.commit()` and `conn.rollback()`) is still crucial for ensuring data integrity, especially after write operations. Forgetting to commit will result in changes not being saved.fixAlways call `conn.commit()` after any operations that modify the database (INSERT, UPDATE, DELETE). Use `conn.rollback()` if an error occurs and changes should not be persisted. Consider using a `try...except...finally` block for robust error handling and resource management.
affects: All
Upgrade
Version history
2.0.4latest on PyPI · released Nov 2, 2021
Audit
Dependencies
No dependency data recorded yet.
Resources
No resource links recorded.