A Rust-powered Python library for scheduled SQLite operations.
Project description
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
schedulepackage
Build
maturin develop
Usage
With the Python schedule package
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
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
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
pytest
Examples
See the examples/ directory.
python examples/basic_crud.py
python examples/builtin_scheduler.py
python examples/with_schedule_package.py
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqlite_scheduler-0.1.3-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: sqlite_scheduler-0.1.3-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29784c395742d7cc2f513d229efbb1d54a6865dd9d351dfd9fa7f0a6efc1e929
|
|
| MD5 |
3b806e181ca66d1e700bbac3b72a10b3
|
|
| BLAKE2b-256 |
8e9386c0c2249e28e9fdc9067488d04dad210b386ec13e728f4a05ba54ec4ab6
|