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.18.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

membank-0.2.18-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for membank-0.2.18.tar.gz
Algorithm Hash digest
SHA256 9db9a7252d370970dbd384739fb94137a9845571d12a8b82e37fdd6ad675b0f3
MD5 c6addc0ed2ec4812e63a8c6c0476f335
BLAKE2b-256 1bc8202b41dfaa1106a41d6518e86a9d8a279f21867c9228254b4fd03ee14d3a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for membank-0.2.18-py3-none-any.whl
Algorithm Hash digest
SHA256 0e1a00709bd3638b41bef53b4b03b191ddc1ffbc92a560f2a29fc3a7f9dab67d
MD5 b56225b1204cca0ccf38c29284eb03bb
BLAKE2b-256 680797ef07e6085582cd91b2400bf285e633ff5253ce1f39a4473aa9c8dfb70d

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