Support returning the rowcount for a given query?
See original GitHub issueHey! Thanks for this awesome library.
I’m replacing direct aiopg
usage with it, but I ran into one issue that I can’t seem to solve. When executing a query aiopg
returns an object with a .rowcount
attribute. This is quite handy when using an INSERT ... ON CONFLICT
query to know how many rows have been inserted.
I cannot seem to find out to how expose this information with this library. I’m guessing it might be more of an issue with asyncpg
, but I was wondering if this is possible and if could be documented somewhere?
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (10 by maintainers)
Top Results From Across the Web
Working with SQL Server ROWCOUNT - SQLShack
To overcome this issue, SQL Server introduces the ROWCOUNT_BIG system function, which returns the number of rows affected by a specific query in ......
Read more >@@ROWCOUNT (Transact-SQL) - SQL Server | Microsoft Learn
Statements that make an assignment in a query or use RETURN in a query set the @@ROWCOUNT value to the number of rows...
Read more >return @@rowcount result on SQL query - Stack Overflow
I wanted to raiserror if exists and then print the number of rows that are matching .But this doesnt work . Please help...
Read more >Optimize query that only returns when the number of rows to ...
1. Presumably you can estimate the odds a call will hit the row count threshold vs not? · @LowlyDBA Yes, we could estimate,...
Read more >Limiting the number of returned rows - Ask TOM
next update/delete/insert *appears* to work but doesn't (only does 20 rows). been there, done that. rowcount on the query is the way to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Currently we’re underspecifying the return type from
execute
, and returning thelastrowid
value.It looks like we probably ought to be returning a richer interface from that, with at least
.lastrowid
, and.rowcount
attributes being supported. Does that sound like the right interface to you folks?@tomchristie
execute
does not return feedback when deleting rows. Returning rows affected would be the standard MySQL way.https://github.com/encode/databases/blob/88b381ae33bcb417b76b8df9149742cbbcc253b5/databases/backends/mysql.py#L134
Always returns 0 because the row no longer exists.
Is there any way to get feedback from a delete?