MagicStack / MagicStack/asyncpg

Best way to spread query over multipule asyncio tasks?

Open
#395 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
8.1k
Forks
468
PR merge metrics
No merged PRs in 30d

Description

I want to the data from a query as data for network actions. I am thinking about the best way to do this.
1> perform a single query and fetch all rows, then divide the result and pa sub part to each task
easy, but not good for large amount of data
2> Use a asyncio Queue. The producer would use a cursor to read that data and each task would be a consumer
difficult, do not know it would work.
3> Use pooled connections. but there would have to be a global "next".for each query
dumb idea

What would be the best and simplest way to query the database and do network actions and then use pooled connections to write a result?

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names no files, tests, or entry points to inspect. Start by reviewing asyncpg's query, cursor, pooling, and transaction documentation, then define a supported pattern for consuming query rows, performing network actions, and writing results with pooled connections.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.