Skip to content

Project to test Python + Postgres + pq (Simple transactional queue for PostgreSQL written in Python)

Notifications You must be signed in to change notification settings

stephane-klein/python-postgres-pq-poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Postgres pq POC

I created this project to test how the pq (Simple transactional queue for PostgreSQL written in Python) library works and how I can create jobs directly from sql queries and not only via Python.

Prerequisites

  • Docker
  • Python 3
  • Poetry:
$ pip install poetry

Getting started

$ poetry install
$ docker-compose up -d

In a first terminal, start:

$ poetry run ./server.py

In a second terminal, start another server:

$ poetry run ./server.py

In a third terminal, create a job:

$ poetry run ./create-a-job.py

You can also create a job via PostreSQL console:

$ ./scripts/enter-in-pg.sh
postgres=# INSERT INTO queue (q_name, data) VALUES('queue1', '{"foo": "bar2"}');
INSERT 0 1
postgres=#

Demo

asciicast

About

Project to test Python + Postgres + pq (Simple transactional queue for PostgreSQL written in Python)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published