MagicStack / MagicStack/asyncpg
Get number of rows in cursor ? (equivalent to psycopg2#cursor.rowcount)
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 8.1k
- Forks
- 468
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
- asyncpg version: 0.15
- PostgreSQL version: 9.6
- Python version: 3.6.5
- Platform: Debian Buster
- Do you use pgbouncer?: no
- Did you install asyncpg with pip?: no
- Can the issue be reproduced under both asyncio and uvloop?: N/A
Warning: It's may be a duplicate of #311
I would like to get the number of rows from the last query (a SELECT query). An equivalent to cursor.rowcount in psycopg2.
I saw in #311 that we can get the query status line (as a string) from execute function. Actually, I'm not able to use it since I need a cursor. Don't know very well binary protocol of pg.. I don't even know if it is possible to get it.
The purpose of this issue is to avoid doing multiple queries (for instance with count(*) statement).
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
Beginne mit der Cursor-API und der Funktion execute, und prüfe anschließend das im Issue referenzierte Verhalten der PostgreSQL-Statuszeile. Ermittle, ob ein Cursor die Zeilenanzahl seines letzten SELECT ohne eine zusätzliche count(*)-Abfrage bereitstellen kann, und ergänze Tests für das angeforderte Verhalten.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- postgresql, python
- Bereich
- database
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100