Metadata-Version: 2.3
Name: sqlpile
Version: 0.1.1
Summary: Add your description here
Author-email: Kevin Hill <kivo360@gmail.com>
Requires-Python: >=3.8
Requires-Dist: aiosqlite>=0.20.0
Requires-Dist: asyncer>=0.0.7
Requires-Dist: cloudpickle>=3.0.0
Requires-Dist: cytoolz>=0.12.3
Requires-Dist: devtools>=0.12.2
Requires-Dist: diskcache>=5.6.3
Requires-Dist: duckdb-engine>=0.12.0
Requires-Dist: duckdb>=0.10.2
Requires-Dist: lancedb>=0.6.11
Requires-Dist: loguru>=0.7.2
Requires-Dist: lz4>=4.3.3
Requires-Dist: psycopg[binary]>=3.1.18
Requires-Dist: pydantic-settings>=2.2.1
Requires-Dist: pyrsistent>=0.20.0
Requires-Dist: rich>=13.7.1
Requires-Dist: sqlalchemy>=2.0.29
Requires-Dist: toolz>=0.12.1
Requires-Dist: xxhash>=3.4.1
Description-Content-Type: text/markdown

# 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

```bash
pip install sqlpile
```

## Usage

```python
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

```python
from sqlpile.config import Config

config = ApplicationSettings(
    local_database_type="sqlite",
    local_database_name="cache.db",
    remote_database_type="postgresql",
    # ...
)

```