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-lochan

Quick Start

from sqliter-lochan 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-lochan 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.1.tar.gz (2.9 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.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqliter_lochan-0.1.1.tar.gz
  • Upload date:
  • Size: 2.9 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.1.tar.gz
Algorithm Hash digest
SHA256 a38e5b76ee9cd9c09a92adc21d0f841fb8a755b18ab737c07bbfc4241895054a
MD5 48b1ff54154cbe570f453884933f613d
BLAKE2b-256 5b7104b94a47c6d607789f74d07a5698f235d021b8751c93febd14a8b88c6242

See more details on using hashes here.

File details

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

File metadata

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

Hashes for sqliter_lochan-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b97502ba21aceb93e82b1359862a8ec0ab69a518fb38e7b3fe91412369f14f32
MD5 3cf405160df289b3758225c803046ea2
BLAKE2b-256 3219a0f1e9f58c4d781e6ba3fde9d70b45d40621a49e63ad8b192fb818011e3e

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