Skip to main content

A library to handle persistent memory

Project description

membank

Python library for storing data in persistent memory (sqlite, postgresql, berkeley db)

goals

Provide interface to database storage that automates heavy lifting of database setup, migration, table definition, query construction.

quick intro

add items to persistent storage

import dataclasses as data # Python standard library

from membank import LoadMemory

@data.dataclass
class Dog():
    breed: str
    color: str = "black"
    weight: float = 0

memory = LoadMemory() # defaults to sqlite memory
memory.put(Dog('Puli')) # stores object into database
dog = memory.get.dog() # retrieves first object found
assert dog.breed == 'Puli'

retrieve those after

memory = LoadMemory() # to make this work in new process, don't use sqlite memory
dog = memory.get.dog() # get first found or None
assert dog.color == 'black'
dogs = memory.get("dog") # always returns list (empty or with items)
assert len(dogs) >= 0

editing returned objects

dog = memory.get.dog()
dog.breed = 'Labdrador'
memory.put(dog) # stores edited object back

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

membank-0.2.13.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

membank-0.2.13-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file membank-0.2.13.tar.gz.

File metadata

  • Download URL: membank-0.2.13.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for membank-0.2.13.tar.gz
Algorithm Hash digest
SHA256 925caa27326cfc48c5cb7a970555384ee3aa41f59aa1168cc660127d59bc4a71
MD5 8711d9102743745e0a5513fbc5afeb6c
BLAKE2b-256 41efca944bf8f6b6694231e386bdd5589551ddc56388af112eadc323ccdd1882

See more details on using hashes here.

File details

Details for the file membank-0.2.13-py3-none-any.whl.

File metadata

  • Download URL: membank-0.2.13-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for membank-0.2.13-py3-none-any.whl
Algorithm Hash digest
SHA256 b0cfea2a43a59a137d919192884d76876a54580dda0f3194f0255f6f7de06c05
MD5 5b242a49a8a9ba479217d11505ad9879
BLAKE2b-256 84c0a79609931bbc0975dede9c5e0c129b744cb92ca79295ae2687f144310cbe

See more details on using hashes here.

Supported by

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