Database storage backends for Jobify
jobify-db provides database storage backends for the Jobify framework. It features:
- PostgreSQL support via
asyncpgandpsycopgdrivers - MongoDB support via
motordriver - MySQL support via
aiomysqldriver - Accepts either a connection string or an externally managed pool/client
- Automatic table/collection creation on startup
Installation
Install with the driver you need:
pip install jobify-db[asyncpg]
pip install jobify-db[psycopg]
pip install jobify-db[motor]
pip install jobify-db[aiomysql]
Or with uv:
uv add "jobify-db[asyncpg]"
uv add "jobify-db[psycopg]"
uv add "jobify-db[motor]"
uv add "jobify-db[aiomysql]"
How to use
PostgreSQL with asyncpg
import asyncio
from jobify import Jobify
from jobify_db.postgresql.asyncpg import AsyncpgStorage
app = Jobify(
storage=AsyncpgStorage(dsn="postgresql://user:password@localhost:5432/mydb"),
)
@app.task(cron="*/5 * * * *")
async def my_task() -> None:
print("Running periodic task every 5 minutes")
async def main() -> None:
async with app:
await app.wait_all()
if __name__ == "__main__":
asyncio.run(main())
PostgreSQL with psycopg
import asyncio
from jobify import Jobify
from jobify_db.postgresql.psycopg import PsycopgStorage
app = Jobify(
storage=PsycopgStorage(
conninfo="postgresql://user:password@localhost:5432/mydb",
),
)
@app.task(cron="*/1 * * * *")
async def health_check() -> None:
print("Health check passed")
async def main() -> None:
async with app:
await app.wait_all()
if __name__ == "__main__":
asyncio.run(main())
MongoDB with motor
import asyncio
from jobify import Jobify
from jobify_db.mongodb.motor import MotorStorage
app = Jobify(
storage=MotorStorage(
uri="mongodb://localhost:27017",
database_name="my_app",
),
)
@app.task(cron="0 9 * * 1")
async def weekly_report() -> None:
print("Generating weekly report every Monday at 9 AM")
async def main() -> None:
async with app:
await app.wait_all()
if __name__ == "__main__":
asyncio.run(main())
MySQL with aiomysql
import asyncio
from jobify import Jobify
from jobify_db.mysql.aiomysql import AiomysqlStorage
app = Jobify(
storage=AiomysqlStorage(
host="localhost",
port=3306,
user="root",
password="password",
db="mydb",
),
)
@app.task(cron="*/10 * * * *")
async def sync_data() -> None:
print("Syncing data every 10 minutes")
async def main() -> None:
async with app:
await app.wait_all()
if __name__ == "__main__":
asyncio.run(main())
Using an external pool/client
You can pass an externally managed pool or client instead of a connection string. This is useful when you want to share the pool across multiple components.
import asyncio
import asyncpg
from jobify import Jobify
from jobify_db.postgresql.asyncpg import AsyncpgStorage
DSN = "postgresql://user:password@localhost:5432/mydb"
async def main() -> None:
pool = await asyncpg.create_pool(dsn=DSN, min_size=2, max_size=20)
app = Jobify(storage=AsyncpgStorage(pool=pool))
@app.task(cron="0 3 * * *")
async def nightly_cleanup() -> None:
print("Running nightly cleanup")
async with app:
await app.wait_all()
if __name__ == "__main__":
asyncio.run(main())
The same pattern works for PsycopgStorage(pool=pool), MotorStorage(client=client), and AiomysqlStorage(pool=pool).
Metadata
Release files for jobify-db 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jobify_db-0.0.2.tar.gz | 187.2 kB | Without provenance | Details for jobify_db-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jobify_db-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for jobify_db-0.0.2-py3-none-any.whl |
Total release size: 207.3 kB
Release files / jobify_db-0.0.2.tar.gz
| Download URL | jobify_db-0.0.2.tar.gz |
|---|---|
| Size | 187.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a05512977712695acc7e8719bd582e52ec207257e9ffb7284bbf34e492e4a054
|
|
BLAKE2b-256 checksum How to use checksums |
9ce474267fb6b17763992ee2ace655e95d46769ef55081f722ffc6f597f73867
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / jobify_db-0.0.2-py3-none-any.whl
| Download URL | jobify_db-0.0.2-py3-none-any.whl |
|---|---|
| Size | 20.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc27bf38adf00328d4e49325c93447bb3189750f5d4bbe31e3073a3a333b43b2
|
|
BLAKE2b-256 checksum How to use checksums |
7a9176a20ef7849d5ed27998862f2b4a1b02a9ea9f7b0b041dafd12d45769950
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.17 {"installer":{"name":"uv","version":"0.12.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for jobify-db 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.