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.24.tar.gz (4.9 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.24-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pycyphorm-26.5.24.tar.gz
  • Upload date:
  • Size: 4.9 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.24.tar.gz
Algorithm Hash digest
SHA256 9b8db67a0da2af6bf9fdd56753e014a2cb5abeea1f4dbf8f2044488940435d43
MD5 96086fb3f0771a6aa47955a47c541a45
BLAKE2b-256 786729181e95f385f1ea8227e91c425cf6e4b94d5235d6be42250a4d175e5df8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycyphorm-26.5.24.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.24-py3-none-any.whl.

File metadata

  • Download URL: pycyphorm-26.5.24-py3-none-any.whl
  • Upload date:
  • Size: 5.0 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.24-py3-none-any.whl
Algorithm Hash digest
SHA256 9e263c9933431ad3976abae49a428fb3ba3348daae79c4f35666ab7a4d501612
MD5 8ba784bf32420ed239a263351edd7058
BLAKE2b-256 4c69f1f4a14dd72b3632017060f1747ccc08e0eebeb2811e1bacb3e4c4226760

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycyphorm-26.5.24-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