Skip to main content

A simple in-memory encrypted ORM for SQLite3

Project description

PyCyphORM

A simple in-memory encrypted ORM for SQLite3.

The database lives in memory while in use and is persisted to disk as a gzipped, Fernet-encrypted blob. Keys are derived from a password and salt with PBKDF2-HMAC-SHA256.

Install

pip install PyCyphORM

CLI

Generate a .pyorm config (random salt + password) in the current directory:

pyorm --init 1

Decrypt an encrypted database file to <file>.decoded.db:

pyorm --decrypt path/to/db

Library usage

from pyorm import ORM, load_config

cnf = load_config(".pyorm")

orm = ORM("users.db", cnf["PASSWORD"], cnf["SALT"], {
    "users": {
        "id": "INTEGER PRIMARY KEY AUTOINCREMENT",
        "name": "TEXT NOT NULL",
        "email": "TEXT NOT NULL",
        "age": "INT NOT NULL",
    }
})

users = orm.model("users")
users.insert({"name": "Alice", "email": "alice@example.com", "age": 30})
users.update({"name": "Alice"}, {"age": 31})
print(users.find())
print(users.first({"name": "Alice"}))
users.delete({"name": "Alice"})

orm.save()

orm.save() writes the encrypted snapshot back to disk. Without it, changes remain in memory only.

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

pycyphorm-26.5.25.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

pycyphorm-26.5.25-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file pycyphorm-26.5.25.tar.gz.

File metadata

  • Download URL: pycyphorm-26.5.25.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pycyphorm-26.5.25.tar.gz
Algorithm Hash digest
SHA256 7b419ec8cadfc5532d2a18c764ab43bc3b45489841f1d1dbaea16b3ea857ada7
MD5 8b27442cc8e0657cf7b2d6a8a5c6f9bb
BLAKE2b-256 f513899cac5347ed5ea31565c17b5f10ce3e5ec4007d48261cce504f980af980

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycyphorm-26.5.25.tar.gz:

Publisher: publish.yml on jafrmartins/PyCyphORM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycyphorm-26.5.25-py3-none-any.whl.

File metadata

  • Download URL: pycyphorm-26.5.25-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pycyphorm-26.5.25-py3-none-any.whl
Algorithm Hash digest
SHA256 315cd8763e9b8f14ed310d89a076d825b76dc54b95081fda16338463bc610607
MD5 99b68ff43a040ccde15cee9357895b98
BLAKE2b-256 3043916bc83ded04a30b7524b06d4a9a118be9a97e4ff5a61040387298ef337f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycyphorm-26.5.25-py3-none-any.whl:

Publisher: publish.yml on jafrmartins/PyCyphORM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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