MagicStack / MagicStack/asyncpg
Best way to spread query over multipule asyncio tasks?
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 8.1k
- Forks
- 468
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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?
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Das Issue nennt keine Dateien, Tests oder Einstiegspunkte, die geprüft werden sollen. Beginne damit, die Dokumentation von asyncpg zu Abfragen, Cursors, Pooling und Transaktionen zu prüfen, und definiere anschließend ein unterstütztes Muster für das Verarbeiten von Abfragezeilen, das Ausführen von Netzwerkaktionen und das Schreiben von Ergebnissen mit gepoolten Verbindungen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- postgresql, python
- Bereich
- database
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 20/100