MagicStack / MagicStack/asyncpg
Get number of rows in cursor ? (equivalent to psycopg2#cursor.rowcount)
还没有人认领这个 Issue。
- 主要语言
- 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).
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先从游标 API 和 execute 函数开始,然后查看 issue 中引用的 PostgreSQL 状态行行为。确定游标是否可以在不执行额外 count(*) 查询的情况下提供其上一次 SELECT 返回的行数,并为所请求的行为添加覆盖测试。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- postgresql, python
- 领域
- database
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100