MagicStack / MagicStack/asyncpg

Get number of rows in cursor ? (equivalent to psycopg2#cursor.rowcount)

オープン
#359 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

question
主要言語
Python
スター
8.1k
フォーク
468
PR マージ指標
30日以内にマージされた PR はありません

説明

  • 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).

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まずカーソル API と execute 関数から始め、次に issue で参照されている PostgreSQL のステータス行の動作を確認します。カーソルが追加の count(*) クエリなしで最後の SELECT の行数を公開できるかどうかを判断し、要求された動作のカバレッジを追加します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
postgresql, python
領域
database
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。