malthe/pq

asyncio variant would be great

vlcinsky opened this issue · 1 comments

Waiting for new item from a queue shall be awaitable, allowing other tasks around to run.

As there exist asyncio version of postgresql driver, it should be technically possible.

As it would break python 2.x compatibility, it would probably require either fork or new, backward incompatible version.

Regarding "patches welcome" my current priority is to implement it for single consumer consuming items in order of insertion. If I succeed with anything (matter of my capacity and other priorities), I would leave a note here.

You could just use the queue from a separate thread which could then message your asyncio main loop when a new message was available.

But it depends on your setup. PostgreSQL needs a proxy to support many connections.