Skip to main content

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
    data: dict = data.field(default_factory=dict)
    picture: bytes = b''
    aliases: list = data.field(default_factory=list)

@data.dataclass
class DogWithID():
    id: str = data.field(default=None, metadata={"key": True})
    breed: str
    color: str = "black"
    weight: float = 0
    data: dict = data.field(default_factory=dict)
    picture: bytes = b''
    alive: bool = True

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'
dog.color = "white"
memory.put(dog) # be carefull you store another dog
dog = memory.put(DogWithID("AB1234", "Puli"))
dog = memory.get.dogwithid(id="AB1234")
dog.color = "white"
memory.put(dog) # now you update existing dog

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

filter objects

dog = memory.get.dog(breed='Labdrador')
assert dog.breed == 'Labrador'

Metadata

Release files for membank 0.5.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for membank 0.5.6
File Size Uploaded Provenance Actions
membank-0.5.6.tar.gz 18.3 kB Without provenance Details for membank-0.5.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for membank 0.5.6
File Interpreter ABI Platform Actions
membank-0.5.6-py3-none-any.whl Python 3 none any Details for membank-0.5.6-py3-none-any.whl

Total release size: 29.1 kB

Release files / membank-0.5.6.tar.gz

Download URL membank-0.5.6.tar.gz
Size 18.3 kB
Tags Source
SHA-256 checksum
How to use checksums
932d9dd471fe2e9dd5e77546c80ff19fbe559420a7bd0c05c3eb94edd85cdf37
BLAKE2b-256 checksum
How to use checksums
128e536612e412b69195a3c512f902df1b106ac47b1f4228770e7135db5bf25d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / membank-0.5.6-py3-none-any.whl

Download URL membank-0.5.6-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c3f42a4b8dae7190dd1a0ae995bc997c2cab3ea6c30087a4bcb3d990eb2b37d
BLAKE2b-256 checksum
How to use checksums
612fb3efc5658ddc6d17414d07ff6693a8267ff15f827964e7b181079f0d50f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for membank 0.5.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.6 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page