Add your description here
Project description
SQLPile - SQL-Based Multi-Layered Caching (Arrow + SQLite + Postgres)
Full-featured multi-layered distributed cache using SQL databases. Why build a cache on top of a database? Largely because SQL has similar interfaces across many different databases, and it's easy to scale out. This project is a work in progress, and is not yet ready for production use.
Think about this project as if it's like Ibis, but for SQL caching. The goal is to have a simple interface that can be used to cache data in a SQL database. The project is designed to be used with a SQL database, and is not designed to be used with a NoSQL database. Just use redis at that point.
Installation
pip install sqlpile
Usage
from sqlpile import sqlpile
import sleep
@sqlpile
def expensive_function():
sleep.sleep(10)
return 1
def main():
for _ in range(10):
# Moves slow at first, but speeds up over time
print(expensive_function)
Features
- Multi-layered caching using local (SQLite) and remote (Postgres) databases
- Serialization and compression of cached values using cloudpickle and lz4
- Hashing of cache keys using xxhash for efficient lookup
- Automatic caching of function results using a decorator
- Asynchronous support with asyncio and aiosqlite
- Dependency management using pyproject.toml and hatch
- Code style enforcement with ruff
Configuration
from sqlpile.config import Config
config = ApplicationSettings(
local_database_type="sqlite",
local_database_name="cache.db",
remote_database_type="postgresql",
# ...
)
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
Built Distribution
File details
Details for the file sqlpile-0.3.1.tar.gz
.
File metadata
- Download URL: sqlpile-0.3.1.tar.gz
- Upload date:
- Size: 2.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28b7690f91983e514a0cf1bcd656d6a05ee99f5cf1c4806d7ec791240e3cf7b1 |
|
MD5 | 618ba89a6fd6ad2c8aad39ad333c8a0e |
|
BLAKE2b-256 | eb1fa58a7a4644e3076317112805f748afc6e5efa689be2dda6fe279e3c63cb2 |
File details
Details for the file sqlpile-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: sqlpile-0.3.1-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2745d110c65b3f73811082961bc70b9c2d52e72ad9351526d6e9e880854cd1a4 |
|
MD5 | ecd17c7e19d78f0f604c550d09c5b70e |
|
BLAKE2b-256 | 6cc3a28c0a67320ce7487d6642e672daf8d45f9cd6d0280b6393ad526a04ce12 |