Postgres backend plugin for SimpleBroker
Project description
simplebroker-pg
Postgres backend plugin for SimpleBroker.
This package is intentionally separate from simplebroker itself. SimpleBroker
remains SQLite-first. This package adds a Postgres backend through the public
backend plugin hook.
Requirements
- PostgreSQL
- A dedicated schema for SimpleBroker tables
public is intentionally rejected.
Installation
# Add to an existing pipx-installed simplebroker (recommended)
pipx inject simplebroker simplebroker-pg
# Or install with uv to use as a library
uv add simplebroker-pg
# Or with pip
pip install simplebroker-pg
Python Usage
from simplebroker import Queue
from simplebroker_pg import PostgresRunner
runner = PostgresRunner(
"postgresql://postgres@127.0.0.1:54329/simplebroker_test",
schema="simplebroker_app",
)
queue = Queue("jobs", runner=runner, persistent=True)
queue.write("hello")
print(queue.read())
CLI Usage
Create .simplebroker.toml in the project root:
version = 1
backend = "postgres"
target = "postgresql://postgres@127.0.0.1:54329/simplebroker_test"
[backend_options]
schema = "simplebroker_app"
Then use the normal CLI from any child directory with project scope enabled:
broker init
broker write jobs hello
broker read jobs
You can also run entirely from environment variables without a project config:
BROKER_BACKEND=postgres \
BROKER_BACKEND_TARGET='postgresql://postgres@127.0.0.1:54329/simplebroker_test' \
BROKER_BACKEND_SCHEMA='simplebroker_app' \
BROKER_BACKEND_PASSWORD='postgres' \
broker init
Notes:
BROKER_BACKEND_TARGEToverrides the whole target string.BROKER_BACKEND_HOST,BROKER_BACKEND_PORT,BROKER_BACKEND_USER,BROKER_BACKEND_PASSWORD, andBROKER_BACKEND_DATABASEare only used when there is no target from env or toml.BROKER_BACKEND_PASSWORDis never written to.simplebroker.toml.- The Postgres database must already exist.
broker initcreates the managed schema/tables inside that database; it does not create the database itself. - Missing backend/plugin errors are distinct from target/auth errors. Invalid schema names, bad passwords, malformed targets, and missing databases are reported as validation or connection failures, not as "backend not available" errors.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 simplebroker_pg-1.0.3.tar.gz.
File metadata
- Download URL: simplebroker_pg-1.0.3.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c56d86b61f0e0d01bf36d9f3b4ec6b98f02e1296a06b44436192153e60d483fe
|
|
| MD5 |
318a475e7531d2c4750e6fa9be268df3
|
|
| BLAKE2b-256 |
1652f2c91dc356175b7b021aa211934b7b0ffa5a740e964b77dad431024f8f44
|
File details
Details for the file simplebroker_pg-1.0.3-py3-none-any.whl.
File metadata
- Download URL: simplebroker_pg-1.0.3-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbf3a681528577f59e4b03276a5054a6c5cede9cc408e2d5d7660c9601e74827
|
|
| MD5 |
a4d9bc0573fff6ac1a7a7e61c3a27469
|
|
| BLAKE2b-256 |
93c4dc0b34108ad77f8d2f34bfe2096fb1719efd459a6341679cad777dd2b91b
|