A SQLAlchemy based Key-Value store.
Project description
KVAlchemy
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.
More Documentation
For more documentation visit: https://csm10495.github.io/kvalchemy
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kvalchemy-0.2.3.tar.gz.
File metadata
- Download URL: kvalchemy-0.2.3.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2e5bec7c1638961e9d0e1f74f71ecf03bff314682919f8dfa52550027b0784b
|
|
| MD5 |
5cf67cec5b4a87d832069f491c328ad1
|
|
| BLAKE2b-256 |
6d3d40f13e527109a266f5e5be4cd5533e23fa8b72166114d8b0a2b70a371ff8
|
File details
Details for the file kvalchemy-0.2.3-py3-none-any.whl.
File metadata
- Download URL: kvalchemy-0.2.3-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d4d19da77a1c10c0533ef8eea675513e66aace850ae13754dd5efca799276ae
|
|
| MD5 |
976b57e484c11643a6e97a51f9eaf5a2
|
|
| BLAKE2b-256 |
1a5974c6f4db38c2b8dd0a1819a8674d46c448c84446552a521c7fb5acb5389e
|