Skip to content

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

Open
@rmedaer

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions