Databases · Advanced · 28 min
Give the clinic app least-privilege database roles and row-level security
By Padding · Updated 18 Nov 2026
Ubuntu 26.04 · PostgreSQL 18.7
You will move the clinic booking app off its superuser connection onto an app role and a read-only reporting role, each limited to what it uses, beside part 5's owner role for migrations, and add row-level security so staff at one clinic see only that clinic's patients and appointments.
On this page
Part 5 took migrations away from postgres: dbmate now connects as clinic_owner, which owns the clinic database and every table in it. The booking app, though, still talks to the database as postgres. That role is a superuser: it can drop the database, read every row in every database on the server, change any setting and, through COPY ... TO PROGRAM, run shell commands as the operating system user. One SQL injection bug, or one leaked connection string, hands all of that to whoever finds it.
This part takes that power away from the app. Three roles end up with separate jobs:
clinic_owner, from part 5, owns the tables and runs migrations. It is not a superuser, and nothing in this part changes its password.clinic_app, new here, is what the booking app logs in as. It can read and write the tables it uses, in the ways it uses them, and nothing else.clinic_reporting, also new, reads appointment and directory data for dashboards. It cannot see patients' personal details or change anything.
Then you add row-level security, so that even a query with a missing WHERE clause returns only the rows of the clinic the logged-in staff member works at. Each grant is proven with a statement that fails as the wrong role.
Everything here runs on PostgreSQL 18.7, the current 18.x release. PostgreSQL 19.0 came out on 19 November 2026; the statements in this part should work unchanged on it, but they were checked on 18.7 only.
Step 1 · See what the app can do today
Start by looking at the roles on the server and who owns the clinic tables:
sudo -u postgres psql -d clinic -c "\du"
sudo -u postgres psql -d clinic -c "\dt"\du lists two roles: postgres, with attributes such as Superuser, Create role, Create DB, Replication, Bypass RLS, and part 5's clinic_owner, with an empty Attributes column. \dt lists the clinic tables, plus dbmate's schema_migrations, and every one has clinic_owner in the Owner column.
That fixed migrations, not the app. The app's connection string still names postgres, so every request it serves runs as a superuser that skips every grant and every row-level security policy. Pointing the app at clinic_owner instead would not be much better. The owner of a table can always drop it and grant itself any right on it, and it skips row-level security unless you force it. So the app needs a role of its own that owns nothing.
Check it worked
You can name the problem in one line: the tables belong to clinic_owner, which only migrations use, and the app still logs in as postgres, which has Bypass RLS and Superuser. If your \du lists other roles too, leave them alone; this part only adds two.
Step 2 · Create the app and reporting roles
Roles belong to the whole PostgreSQL server, not to one database, which is why each name starts with clinic_: it keeps them apart from roles another database on the same server may need.
sudo -u postgres psql -d clinic -v ON_ERROR_STOP=1 <<'SQL'
CREATE ROLE clinic_app LOGIN;
CREATE ROLE clinic_reporting LOGIN;
SQLCREATE ROLE gives none of the dangerous attributes unless you ask: no superuser, no CREATEDB, no CREATEROLE, no BYPASSRLS. Do not add any of them.
Each new role needs a password. Writing PASSWORD '...' in SQL would leave it in your shell history and possibly the server log, so set them from an interactive psql session with \password, which asks twice and sends the password already hashed. Use two different long random passwords, for example from a password manager. Leave clinic_owner alone: its password is the one part 5 generated and wrote into ~/clinic-demo/.env, and resetting it would lock dbmate out.
sudo -u postgres psqlAt the postgres=# prompt, run these one at a time and type each password when asked:
\password clinic_app
\password clinic_reporting
\qSo you can connect as each role in the rest of this part without typing passwords, store them in ~/.pgpass, which libpq (and so psql) reads. Create the file with private permissions before anything goes in it. If you already have a ~/.pgpass, skip the install line and add to the existing file.
The clinic_owner line reuses the password from part 5's .env. These commands copy it out of DATABASE_URL without printing it or putting it on a command line:
install -m 600 /dev/null ~/.pgpass
(
pw=$(sed -n 's|^DATABASE_URL="postgres://clinic_owner:\([^@]*\)@.*|\1|p' ~/clinic-demo/.env)
test -n "$pw"
printf 'localhost:5432:clinic:clinic_owner:%s\n' "$pw" >> ~/.pgpass
)Then open ~/.pgpass in your editor and add two more lines, replacing the last field of each with the password you set:
localhost:5432:clinic:clinic_app:the-app-password
localhost:5432:clinic:clinic_reporting:the-reporting-passwordThe app itself should get its password the same way, or from your platform's secret store, never from a value in the code. Connecting with -h localhost uses a TCP connection, which a stock Ubuntu install checks with scram-sha-256 passwords; a connection over the local socket would use peer authentication and expect a Linux user called clinic_app.
Check it worked
Connect as the app role and ask who you are, then check the owner's line still matches part 5's password:
psql -h localhost -U clinic_app -d clinic -c "SELECT current_user, session_user;"
psql -h localhost -U clinic_owner -d clinic -c "SELECT count(*) AS migrations FROM schema_migrations;"
sudo -u postgres psql -d clinic -c "\du clinic_*"The first query prints clinic_app twice, and the second prints 5, part 5's migrations. Neither asked for a password. \du clinic_* lists the three roles with an empty Attributes column. If the clinic_owner connection fails with password authentication failed, the sed line found nothing; check that ~/clinic-demo/.env still starts with DATABASE_URL="postgres://clinic_owner:.
Step 3 · Confirm clinic_owner owns everything in the schema
Part 5 moved the database and its tables to clinic_owner, and the migrations it ran since then, such as the patients_sync_names trigger function, were created by clinic_owner through dbmate. Anything else you made by hand as postgres along the way, a view or a helper function, still belongs to postgres, and a migration running as clinic_owner could not change or drop it. Ask PostgreSQL for every object in public that clinic_owner does not own. The query skips functions that belong to an extension such as btree_gist, which stay with postgres:
sudo -u postgres psql -d clinic <<'SQL'
SELECT 'relation' AS kind, c.oid::regclass::text AS name, pg_get_userbyid(c.relowner) AS owner
FROM pg_class c
WHERE c.relnamespace = 'public'::regnamespace
AND c.relkind IN ('r', 'p', 'v', 'm', 'S')
AND pg_get_userbyid(c.relowner) <> 'clinic_owner'
UNION ALL
SELECT 'function', p.oid::regprocedure::text, pg_get_userbyid(p.proowner)
FROM pg_proc p
WHERE p.pronamespace = 'public'::regnamespace
AND pg_get_userbyid(p.proowner) <> 'clinic_owner'
AND NOT EXISTS (
SELECT 1 FROM pg_depend d
WHERE d.classid = 'pg_proc'::regclass AND d.objid = p.oid AND d.deptype = 'e'
);
SQLIf a row comes back, hand that object over with ALTER VIEW name OWNER TO clinic_owner; or ALTER FUNCTION name OWNER TO clinic_owner;, run as postgres, then run the query again. Identity sequences and indexes follow their table, so they never show up on their own.
Keep dbmate's DATABASE_URL pointing at clinic_owner, as part 5 left it, and never run a migration as postgres. This matters for more than tidiness: the default privileges you set in a later step apply only to objects that clinic_owner creates.
Check it worked
The query prints its column headings and (0 rows): there is nothing left for postgres to own in the clinic schema.
Step 4 · Close the database and schema to everyone else
Every role on the server belongs to the pseudo-role PUBLIC, and by default PUBLIC may connect to any database, create temporary tables in it, and use the public schema. PostgreSQL 15 already stopped PUBLIC from creating objects in public, but connecting and looking around is still allowed. Take those away, then give them back to the two roles that need them. The owner keeps its rights without a grant.
sudo -u postgres psql -d clinic -v ON_ERROR_STOP=1 <<'SQL'
REVOKE ALL ON DATABASE clinic FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM PUBLIC;
GRANT CONNECT ON DATABASE clinic TO clinic_app, clinic_reporting;
GRANT USAGE ON SCHEMA public TO clinic_app, clinic_reporting;
SQLUSAGE on a schema lets a role find the objects in it; it still needs a grant on each table to read it. Neither role has CREATE on the schema, so neither can add tables of its own.
Check it worked
Make a throwaway role, ask PostgreSQL what it may do, then remove it:
sudo -u postgres psql -d clinic -v ON_ERROR_STOP=1 <<'SQL'
CREATE ROLE clinic_visitor NOLOGIN;
SELECT has_database_privilege('clinic_visitor', 'clinic', 'CONNECT') AS can_connect,
has_schema_privilege('clinic_visitor', 'public', 'USAGE') AS can_use_schema,
has_database_privilege('clinic_app', 'clinic', 'CONNECT') AS app_can_connect;
DROP ROLE clinic_visitor;
SQLThe visitor gets f for both, and clinic_app gets t. Now try to create a table as the app:
psql -h localhost -U clinic_app -d clinic -c "CREATE TABLE scratch (id int);"PostgreSQL refuses with ERROR: permission denied for schema public. Other databases on the server, such as postgres, keep their defaults; this part only locks down clinic.
Step 5 · Grant each role only what it uses
Work out what the app does before granting anything. The booking app reads the directory tables, reads and books appointments, reschedules or cancels them, reads patients and updates their contact details. It never deletes: a cancelled appointment is a status change, and a patient's history stays. It never changes a fee after booking.
That list turns into grants, some of them on single columns:
sudo -u postgres psql -d clinic -v ON_ERROR_STOP=1 <<'SQL'
-- Directory data: both roles read it, neither writes it.
GRANT SELECT ON clinics, practitioners, services, practitioner_services, opening_hours TO clinic_app, clinic_reporting;
-- Bookings: read and create; change only the time and the status.
GRANT SELECT, INSERT ON appointments TO clinic_app;
GRANT UPDATE (starts_at, ends_at, status) ON appointments TO clinic_app;
-- Patients: read; change only contact details.
GRANT SELECT ON patients TO clinic_app;
GRANT UPDATE (email, phone) ON patients TO clinic_app;
-- Reporting reads bookings, never patients' personal details.
GRANT SELECT ON appointments TO clinic_reporting;
SQLThe directory includes part 1's practitioner_services, which the booking screen reads to show who offers what. If you added lookup tables of your own beyond the ones this series creates, and the app reads them, add them to the first GRANT. Notice what is missing: nobody but the owner has DELETE, TRUNCATE, REFERENCES or TRIGGER, and the app cannot insert patients directly. A later step gives it a safer way to register one.
Check it worked
Look at the access list on the two busiest tables:
sudo -u postgres psql -d clinic -c "\dp appointments" -c "\dp patients"Access privileges shows clinic_app=ar/clinic_owner and clinic_reporting=r/clinic_owner for appointments (a is insert, r is select), and Column privileges lists starts_at, ends_at and status with clinic_app=w/clinic_owner (w is update).
Now try four things each role should not be able to do:
psql -h localhost -U clinic_app -d clinic -c "DELETE FROM appointments WHERE id = 1;"
psql -h localhost -U clinic_app -d clinic -c "UPDATE appointments SET fee = 0 WHERE id = 1;"
psql -h localhost -U clinic_app -d clinic -c "DROP TABLE appointments;"
psql -h localhost -U clinic_reporting -d clinic -c "SELECT full_name, phone FROM patients LIMIT 5;"The first, second and fourth fail with ERROR: permission denied for table appointments (or patients), and the third with ERROR: must be owner of table appointments. The same roles can still do their jobs:
psql -h localhost -U clinic_app -d clinic -c "SELECT count(*) FROM appointments;"
psql -h localhost -U clinic_reporting -d clinic -c "SELECT status, count(*) FROM appointments GROUP BY status ORDER BY status;"Step 6 · Cover tables that do not exist yet
Grants apply to objects that exist when you run them. The next migration that adds a table would leave the app unable to read it, and the usual fix under pressure is GRANT ALL. Default privileges decide in advance what objects created by clinic_owner get:
sudo -u postgres psql -d clinic -v ON_ERROR_STOP=1 <<'SQL'
ALTER DEFAULT PRIVILEGES FOR ROLE clinic_owner IN SCHEMA public
GRANT SELECT, INSERT, UPDATE ON TABLES TO clinic_app;
ALTER DEFAULT PRIVILEGES FOR ROLE clinic_owner
REVOKE EXECUTE ON FUNCTIONS FROM PUBLIC;
SQLThe first statement gives the app plain read and write on new tables; a migration can narrow that for a table that needs it, as the next step does. The reporting role gets nothing by default, because a new table may hold personal data.
The second statement matters because every role may run every new function unless told otherwise. It has no IN SCHEMA: default privileges set for one schema can only add to the server-wide defaults, never take away from them, so a revoke has to be written without a schema.
Check it worked
List the default privileges, then create a table as the owner, the way a migration would, and see what each role got:
sudo -u postgres psql -d clinic -c "\ddp"
psql -h localhost -U clinic_owner -d clinic -v ON_ERROR_STOP=1 <<'SQL'
CREATE TABLE sms_reminders (
id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
appointment_id bigint NOT NULL REFERENCES appointments (id),
send_at timestamptz NOT NULL
);
SELECT has_table_privilege('clinic_app', 'sms_reminders', 'INSERT') AS app_insert,
has_table_privilege('clinic_app', 'sms_reminders', 'DELETE') AS app_delete,
has_table_privilege('clinic_reporting', 'sms_reminders', 'SELECT') AS reporting_select;
DROP TABLE sms_reminders;
SQL\ddp shows two rows for clinic_owner: one for tables in public granting clinic_app=arw/clinic_owner, and one for functions with no schema. The query prints t, f, f. The demo table is dropped straight away; on your server, a reminders table like this would arrive in a dbmate migration.
Step 7 · Link patients to clinics and add a registration function
Row-level security needs to know which clinic each row belongs to. Appointments already say so through their practitioner, and part 3's two-column foreign key keeps their own clinic_id in step with it. Patients do not: one person may visit two clinics in the group, so part 1's single clinic_id column on patients, which records only where someone first registered and which part 3 left empty for the generated patients, is not enough. Add a link table, filled from the appointments each clinic already has.
This part applies every change by hand with psql, so you can see each one take effect: the grants, the link table, the functions and the policies. A real project would put them into dbmate migrations as part 5 does, with a -- migrate:down that undoes each one; creating roles and setting their passwords stays outside migrations, because clinic_owner cannot create roles. Do not copy SQL you have already run here into a new migration file and then run dbmate migrate: dbmate would apply it a second time and stop with an error such as relation "clinic_patients" already exists. If you do move this SQL into a migration, record its version as applied first, the way part 5 recorded its baseline in schema_migrations.
Create the link table as clinic_owner:
psql -h localhost -U clinic_owner -d clinic -v ON_ERROR_STOP=1 <<'SQL'
CREATE TABLE clinic_patients (
clinic_id bigint NOT NULL REFERENCES clinics (id) ON DELETE RESTRICT,
patient_id bigint NOT NULL REFERENCES patients (id) ON DELETE RESTRICT,
registered_at timestamptz NOT NULL DEFAULT now(),
PRIMARY KEY (clinic_id, patient_id)
);
INSERT INTO clinic_patients (clinic_id, patient_id)
SELECT DISTINCT pr.clinic_id, a.patient_id
FROM appointments a
JOIN practitioners pr ON pr.id = a.practitioner_id;
-- The default privileges gave the app insert and update; it only needs to read.
REVOKE INSERT, UPDATE ON clinic_patients FROM clinic_app;
SQLPatients you registered by hand with a clinic_id, as in part 1, can be linked the same way: add SELECT clinic_id, id FROM patients WHERE clinic_id IS NOT NULL pairs to clinic_patients with ON CONFLICT DO NOTHING.
Next, two functions. current_clinic_id() reads the clinic the app has set for this transaction, and returns NULL when nothing is set, including after a setting has been reset to an empty string. register_patient() creates a patient and links them to that clinic in one go. It is SECURITY DEFINER, so it runs with the owner's rights, which is how the app can add a patient without having INSERT on patients. Such a function must fix its search_path and name its tables in full, or a caller could make it run objects of their own:
psql -h localhost -U clinic_owner -d clinic -v ON_ERROR_STOP=1 <<'SQL'
CREATE FUNCTION current_clinic_id() RETURNS bigint
LANGUAGE sql STABLE
RETURN nullif(current_setting('app.clinic_id', true), '')::bigint;
CREATE FUNCTION register_patient(p_full_name text, p_email text, p_phone text)
RETURNS bigint
LANGUAGE plpgsql
SECURITY DEFINER
SET search_path = pg_catalog, pg_temp
AS $$
DECLARE
v_clinic bigint := public.current_clinic_id();
v_patient bigint;
BEGIN
IF v_clinic IS NULL THEN
RAISE EXCEPTION 'app.clinic_id is not set';
END IF;
INSERT INTO public.patients (full_name, email, phone)
VALUES (p_full_name, p_email, p_phone)
RETURNING id INTO v_patient;
INSERT INTO public.clinic_patients (clinic_id, patient_id)
VALUES (v_clinic, v_patient);
RETURN v_patient;
END;
$$;
GRANT EXECUTE ON FUNCTION current_clinic_id(), register_patient(text, text, text) TO clinic_app;
SQLIf part 5's name split has reached the contract stage and full_name is gone, insert into the new name columns instead.
The app tells PostgreSQL which clinic it is acting for at the start of each transaction, using the clinic of the logged-in staff member. set_config(..., true) makes the setting last only until the transaction ends, which keeps it from leaking to the next user of a pooled connection, including through PgBouncer in transaction mode. Register a new patient at clinic 4:
psql -h localhost -U clinic_app -d clinic -v ON_ERROR_STOP=1 <<'SQL'
BEGIN;
SELECT set_config('app.clinic_id', '4', true);
SELECT register_patient('Ngozi Eze', 'ngozi.eze@example.com', '+2348030000001');
COMMIT;
SQLCheck it worked
The function returns the new patient's id. The owner sees the link, and the reporting role cannot run the function at all, thanks to the default privileges from the last step:
psql -h localhost -U clinic_owner -d clinic -c "SELECT cp.clinic_id, p.full_name FROM clinic_patients cp JOIN patients p ON p.id = cp.patient_id WHERE p.email = 'ngozi.eze@example.com';"
psql -h localhost -U clinic_owner -d clinic -c "SELECT has_function_privilege('clinic_reporting', 'register_patient(text, text, text)', 'EXECUTE') AS reporting_can_register;"The first query prints clinic 4 and Ngozi Eze; the second prints f. Calling register_patient without setting app.clinic_id first fails with ERROR: app.clinic_id is not set.
Step 8 · Turn on row-level security
With row-level security on, a table returns only the rows a policy allows for the current role, and a role with no policy gets no rows at all. Turn it on for the three tables that hold clinic-specific data, then write the policies as clinic_owner:
psql -h localhost -U clinic_owner -d clinic -v ON_ERROR_STOP=1 <<'SQL'
BEGIN;
ALTER TABLE appointments ENABLE ROW LEVEL SECURITY;
ALTER TABLE patients ENABLE ROW LEVEL SECURITY;
ALTER TABLE clinic_patients ENABLE ROW LEVEL SECURITY;
CREATE POLICY clinic_patients_same_clinic ON clinic_patients
FOR SELECT TO clinic_app
USING (clinic_id = current_clinic_id());
CREATE POLICY patients_same_clinic ON patients
FOR ALL TO clinic_app
USING (EXISTS (
SELECT 1 FROM clinic_patients cp
WHERE cp.patient_id = patients.id AND cp.clinic_id = current_clinic_id()
));
CREATE POLICY appointments_same_clinic ON appointments
FOR ALL TO clinic_app
USING (EXISTS (
SELECT 1 FROM practitioners pr
WHERE pr.id = appointments.practitioner_id AND pr.clinic_id = current_clinic_id()
))
WITH CHECK (
EXISTS (
SELECT 1 FROM practitioners pr
WHERE pr.id = appointments.practitioner_id AND pr.clinic_id = current_clinic_id()
)
AND EXISTS (
SELECT 1 FROM clinic_patients cp
WHERE cp.patient_id = appointments.patient_id AND cp.clinic_id = current_clinic_id()
)
);
CREATE POLICY appointments_reporting_all ON appointments
FOR SELECT TO clinic_reporting
USING (true);
COMMIT;
SQLUSING filters the rows a role can see, update or delete. WITH CHECK tests rows being written, so the app cannot book a practitioner from another clinic, or a patient who is not registered at its own clinic. The patients policy has no WITH CHECK, so the USING condition applies to updates too. The reporting role sees all appointments across the group, but still has no access to patients.
Two roles skip these policies: superusers, and clinic_owner because it owns the tables. That is what you want for migrations and backfills, and it is also why register_patient works. ALTER TABLE ... FORCE ROW LEVEL SECURITY would apply the policies to the owner as well; leave it off unless your migrations never need to see every row.
Be clear about what this protects against. The app sets app.clinic_id itself, so a compromised app could set any clinic. Row-level security guards against the far more common bug: a query that forgets WHERE clinic_id = ..., or an endpoint that takes an appointment id from the URL without checking it. Take the clinic from the server-side login session, never from a request parameter. Where reception staff share one computer or tablet, give each person their own app login, because the database sees only clinic_app and cannot tell them apart.
Check it worked
Compare what the owner and the app see. First the true counts for clinics 3 and 4, as the owner:
psql -h localhost -U clinic_owner -d clinic -c "SELECT pr.clinic_id, count(*) FROM appointments a JOIN practitioners pr ON pr.id = a.practitioner_id WHERE pr.clinic_id IN (3, 4) GROUP BY pr.clinic_id ORDER BY pr.clinic_id;"Then the same questions as the app, with no clinic set, as clinic 3 and as clinic 4:
psql -h localhost -U clinic_app -d clinic -v ON_ERROR_STOP=1 <<'SQL'
SELECT count(*) AS no_clinic_set FROM appointments;
BEGIN;
SELECT set_config('app.clinic_id', '3', true);
SELECT count(*) AS clinic_3_appointments FROM appointments;
SELECT count(*) AS ngozi_seen_by_clinic_3 FROM patients WHERE email = 'ngozi.eze@example.com';
COMMIT;
BEGIN;
SELECT set_config('app.clinic_id', '4', true);
SELECT full_name, phone FROM patients WHERE email = 'ngozi.eze@example.com';
COMMIT;
SQLWith no clinic set the count is 0: the policy fails closed. As clinic 3, the count matches the owner's figure for clinic 3, and Ngozi is invisible. As clinic 4, her row comes back. The reporting role still counts every appointment:
psql -h localhost -U clinic_reporting -d clinic -c "SELECT count(*) FROM appointments;"Last, try to book, as clinic 3, an appointment with a practitioner from clinic 4:
psql -h localhost -U clinic_app -d clinic -v ON_ERROR_STOP=1 <<'SQL'
BEGIN;
SELECT set_config('app.clinic_id', '3', true);
INSERT INTO appointments (clinic_id, practitioner_id, patient_id, service_id, starts_at, ends_at, fee)
SELECT 4, (SELECT min(id) FROM practitioners WHERE clinic_id = 4),
(SELECT min(patient_id) FROM clinic_patients),
(SELECT min(id) FROM services WHERE clinic_id = 4),
'2031-01-06 09:00+01', '2031-01-06 09:30+01', 15000.00;
COMMIT;
SQLPostgreSQL refuses with ERROR: new row violates row-level security policy for table "appointments". To see what the policies add, run EXPLAIN ANALYZE on one of part 4's queries as clinic_app with a clinic set: the plan gains a join to practitioners, filtered on current_clinic_id(). Its exact shape depends on your indexes and data, so compare the timing with the same query run as clinic_owner.
Leave the roles, the clinic_patients table and the policies in place. Part 7 backs up and restores this database as it now stands, and part 8 tunes the clinic_app role and holds the series clean-up.
Next steps
- Back up the database, roles and all, and recover it to a point in time:
/tutorials/recover-the-clinic-database-to-a-point-in-time. - Close the other door into the data, unsafe query building in the app:
/tutorials/prevent-sql-injection-in-python-and-node. - Put PgBouncer in front of
clinic_appand keep the clinic setting transaction-local:/tutorials/pool-postgresql-connections-with-pgbouncer.
Related tutorials
- Use SQLite safely in a Python app: WAL mode, foreign keys and busy timeoutsYou will build a small room-booking store on SQLite with Python 3.15, reproduce the "database is locked" error with two writer processes, and end with a connection helper that turns on foreign keys, WAL mode, a busy timeout and BEGIN IMMEDIATE writes, plus a tested online backup.
- Throttle login attempts with a sliding window in RedisYou will protect a Python login function from password guessing with a sliding-window log in Redis sorted sets, checked atomically in a Lua script, with per-address lockouts that double each time, an account-wide rule that asks for an extra check instead of locking the owner out, and tests that replay 50 guesses.
- Run background jobs with Redis Streams and consumer groupsYou will build a small receipt-sending job queue on Redis 8 Streams with two Python workers that share the work, recover jobs from a crashed worker, park repeated failures in a dead-letter stream and never send the same receipt twice.
Need this done for you?
Padding does this work for growing companies, from the first diagnosis to a system that keeps working.
Get new tutorials