A simple, clean SQLite database wrapper for Python
Project description
sqliter
A simple, clean SQLite database wrapper for Python. No dependencies. No complexity. Just works.
Installation
pip install sqliter
Quick Start
from sqliter import Database
db = Database("myapp.db")
# Create table
db.query("CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT, age INTEGER)")
# Insert
db.query("INSERT INTO users (name, age) VALUES (?, ?)", ("Rahul", 21))
# Fetch one
user = db.query("SELECT * FROM users WHERE name = ?", ("Rahul",), operation="fetchone")
print(dict(user)) # {'id': 1, 'name': 'Rahul', 'age': 21}
# Fetch all
users = db.query("SELECT * FROM users", operation="fetchall")
for u in users:
print(dict(u))
Operations
| Operation | Description | Returns |
|---|---|---|
"commit" |
INSERT, UPDATE, DELETE, CREATE | True |
"fetchone" |
SELECT single row | Row or None |
"fetchall" |
SELECT all rows | list[Row] |
Error Handling
from sqliter import Database, DatabaseError
db = Database("myapp.db")
try:
db.query("INSERT INTO users (name) VALUES (?)", ("Rahul",))
except DatabaseError as e:
print(f"Something went wrong: {e}")
Why sqliter?
- Zero dependencies — only uses Python's built-in
sqlite3 - One method for all operations — simple and predictable
- Returns dict-like rows — easy to work with
- Proper exceptions — errors never go unnoticed
Running Tests
pip install pytest
pytest tests/
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sqliter_lochan-0.1.0.tar.gz
(2.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqliter_lochan-0.1.0.tar.gz.
File metadata
- Download URL: sqliter_lochan-0.1.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27cae5241a27fe545ac403c21ad86eb79f5f20a79fbf292b5157009bc0e87b43
|
|
| MD5 |
674df8c83bcf62ad1b6d51031518cb19
|
|
| BLAKE2b-256 |
f4f75bc5a6d41485d309da83bd6a2f76a510f766ca4c069d1417f968427cfd79
|
File details
Details for the file sqliter_lochan-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sqliter_lochan-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ad620e35e181bd497988c2faff1cdd27fd4a677ca1c38bd19a31346d8598840
|
|
| MD5 |
b1289cddb7aa3153572eb398a0b381bd
|
|
| BLAKE2b-256 |
7e055d627f93408976e2827f60cf890ccf8f68717cfc1a3923b87ed06e63488d
|