Skip to main content

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 (?, ?)", ("Elone", 21))

# Fetch one
user = db.query("SELECT * FROM users WHERE name = ?", ("Elone",), operation="fetchone")
print(dict(user))  # {'id': 1, 'name': 'Elone', '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 (?)", ("Elone",))
except DatabaseError as e:
    print(f"Something went wrong: {e}")

Why sqliter-lochan?

  • 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.2.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqliter_lochan-0.1.2-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file sqliter_lochan-0.1.2.tar.gz.

File metadata

  • Download URL: sqliter_lochan-0.1.2.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

Hashes for sqliter_lochan-0.1.2.tar.gz
Algorithm Hash digest
SHA256 52bc685552115f1497d8444aa168ac7acab1914e6af7c05c23a3d75a1593169a
MD5 ac48af57755fe3c48e5fe8e8f2e86c79
BLAKE2b-256 c3ec1e2e6f8e8d680699abff4c77c8a9c19aaa2c47b21b6a289d507b17584fd3

See more details on using hashes here.

File details

Details for the file sqliter_lochan-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: sqliter_lochan-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for sqliter_lochan-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d6ea7ca4311cfd65ef28487bf14e4006842a6825779a88cc59082b6b608cec99
MD5 215ca55ad774f4a270e2edd21e7f966f
BLAKE2b-256 0f910fbb55e0608d42042a42f74fbb3eb298bc874eba85837481b86cebbcb7e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page