Skip to main content

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

sqlpile-0.3.0.tar.gz (2.6 MB view details)

Uploaded Source

Built Distribution

sqlpile-0.3.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file sqlpile-0.3.0.tar.gz.

File metadata

  • Download URL: sqlpile-0.3.0.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

Hashes for sqlpile-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e27f03b5c4af7bfb0306ff5f43d43e5d2e66bf615e946a072a422c6b7218a3b6
MD5 0f24cc246b320a9ba0fa5bc7c389bd60
BLAKE2b-256 28cce2495158c2633cf9e1e0733be0276eedaab1064a5b8f742c3439b8ace3b5

See more details on using hashes here.

File details

Details for the file sqlpile-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: sqlpile-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for sqlpile-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b35a868339a8c4baf0853f518495c03c1626b8c2640ccb18e17e7ddcb49c2b34
MD5 3ba6fc5b3d454202c2e1b35064f6c7f6
BLAKE2b-256 82bbc86d49ab0e3bdccc507f7ad722e13d9ca4b6ab5733962eb1ef69e8c61ddd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page