An example repo that uses FastAPI to create a Websocket backend service that notifies in realtime about db updates.
Full tutorial in spanish at Notificaciones en tiempo real con Python y Postgres English version at Real-time notifications with Python and Postgres