https://github.com/spirali/revault
Storage of Python computations in DB
https://github.com/spirali/revault
Last synced: over 1 year ago
JSON representation
Storage of Python computations in DB
- Host: GitHub
- URL: https://github.com/spirali/revault
- Owner: spirali
- License: mit
- Created: 2024-06-11T12:37:15.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-05T11:22:14.000Z (almost 2 years ago)
- Last Synced: 2025-01-13T06:28:29.612Z (over 1 year ago)
- Language: Python
- Size: 73.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Result Vault
Python module for persisting results of computation in a database.
It is desinged mainly for storing results from experiments, not for usage as cache.
Therefore it supports data quering and not features like time-to-live.
```python
from revault import computation, Store
@computation
def my_computation(x, y):
return x + y
with Store("sqlite:///path/to/db"):
assert my_computation(10, 20) == 30 # the function my_computation is performed
assert my_computation(10, 20) == 30 # the result is taken from DB
assert my_computation.load(10, 20) == 30 # load from DB, fails if not exists
my_computation(10, 20, replica=1) # call the function again and store the results
my_computation(10, 20, replica=2) # call the function again and store the results
assert my_computation.load_replicas(10, 20) == [30, 30, 30] # Load all replicas for given call
```