Skip to main content

KVAlchemy

PyPI version

KVAlchemy is a SQLAlchemy-based key-vault store. It has the ability to get/set values based off a string key, an optional string tag, and an optional expiration time. Additionally it has a built-in ability to memoize function results to the store.

Example

from kvalchemy import KVAlchemy

# Setup. Supports any available sqlalchemy backend.
k = KVAlchemy('sqlite://')

# Set/Get
k.set("hello", "world")
assert k.get("hello") == "world"

# Default values
assert k.get("hello again", "default") == "default"

# memoize example
import time

@k.memoize()
def func():
    time.sleep(1)

func() # Will sleep
func() # Won't sleep

func.cache_clear()
func() # Will sleep

# proxy example
proxy = k.get_proxy('pizza')
proxy.set('pie')
assert proxy.get() == 'pie'
proxy.delete()
assert proxy.get('default') == 'default'

Installation

On Python 3.8 or later:

pip install kvalchemy

Versioning

Note that the database format is stable across the same patch version.

For example: Version 0.0.1 will be fully compatible with all releases in the 0.0.X family.
Though Version 0.1.0 may not be directly compatible without a manual data migration.

Make sure to pin the version family you want: kvalachemy<X.(Y+1).0

Testing

KVAlchemy is tested across multiple database backends including MySQL, Postgres, SQLite, and Oracle.

Run tests and release

More Documentation

For more documentation visit: https://csm10495.github.io/kvalchemy

Metadata

Release files for kvalchemy 0.2.3

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

Source distribution (sdist)

Source distribution for kvalchemy 0.2.3
File Size Uploaded
kvalchemy-0.2.3.tar.gz 10.7 kB Details

Built distribution (wheel)

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

Total release size: 19.4 kB

Release files / kvalchemy-0.2.3.tar.gz

Download URL kvalchemy-0.2.3.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d2e5bec7c1638961e9d0e1f74f71ecf03bff314682919f8dfa52550027b0784b
BLAKE2b-256 checksum
How to use checksums
6d3d40f13e527109a266f5e5be4cd5533e23fa8b72166114d8b0a2b70a371ff8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Release files / kvalchemy-0.2.3-py3-none-any.whl

Download URL kvalchemy-0.2.3-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d4d19da77a1c10c0533ef8eea675513e66aace850ae13754dd5efca799276ae
BLAKE2b-256 checksum
How to use checksums
1a5974c6f4db38c2b8dd0a1819a8674d46c448c84446552a521c7fb5acb5389e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.1

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

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