Metadata-Version: 2.4
Name: sqlite-scheduler
Version: 0.1.1
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: License :: OSI Approved :: MIT License
Requires-Dist: maturin ; extra == 'dev'
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: schedule ; extra == 'dev'
Provides-Extra: dev
Summary: A Rust-powered Python library for scheduled SQLite operations.
Author: Richard-collab
License: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# sqlite-scheduler

A Rust-powered Python library for scheduled SQLite operations.

- Python 3.9+
- Rust-backed SQLite I/O via `rusqlite`
- Built-in interval scheduler running in a native thread
- Optional integration with the popular Python `schedule` package

## Build

```bash
maturin develop
```

## Usage

### With the Python `schedule` package

```python
import sqlite_scheduler
import schedule
import time

def job():
    sqlite_scheduler.execute_sql(
        "app.db",
        "INSERT INTO logs(msg) VALUES (?)",
        parameters=["heartbeat"],
    )

schedule.every(10).seconds.do(job)
while True:
    schedule.run_pending()
    time.sleep(1)
```

### With the built-in scheduler

```python
from sqlite_scheduler import SqliteScheduler

scheduler = SqliteScheduler("app.db")
scheduler.add_interval_job(10, "INSERT INTO logs(msg) VALUES ('tick')")
scheduler.start(blocking=False)
# ...
scheduler.stop()
```

### Basic CRUD

```python
import sqlite_scheduler

sqlite_scheduler.execute_sql(
    "app.db",
    "CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)",
)

rows = sqlite_scheduler.execute_sql(
    "app.db", "SELECT * FROM users", fetch=True
)
print(rows)  # [{'id': 1, 'name': 'Alice'}, ...]
```

## Run tests

```bash
pytest
```

## Examples

See the `examples/` directory.

```bash
python examples/basic_crud.py
python examples/builtin_scheduler.py
python examples/with_schedule_package.py
```

