MagicStack / MagicStack/asyncpg
conn.execute return value
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.1k
- Forks
- 468
- PR merge metrics
- No merged PRs in 30d
Description
asyncpg version: 0.30
PostgreSQL version:
Do you use a PostgreSQL SaaS? If so, which? Can you reproduce the issue with a local PostgreSQL install?:
Python version: 3.11
Platform: Ubuntu
Do you use pgbouncer?: No
Did you install asyncpg with pip?: Yes
If you built asyncpg locally, which version of Cython did you use?:
Can the issue be reproduced under both asyncio and [uvloop](https://github.com/magicstack/uvloop)?: NA
When I do `execute` on a connection, the return value looks like it brings back the number of rows with `SELECT ` prepended to it.
Example:
If you run:
```sql
conn.execute("SELECT now();")
```
The output is `SELECT 1`
If you run:
```sql
conn.execute("SELECT generate_series(0, 100);")
```
The output is `SELECT 101`
Obviously with a `fetch` it brings back the correct result, but I am specifically interested in the return value of a multi statement `execute`.
ie, I want to do
```sql
conn.execute("SELECT generate_series(0, 100); SELECT now();")
```
And the return value should be the last return value.
Is this possible? What am I missing?
Thanks in advance
And PS. The ISSUE_TEMPLATE is not applying when creating the issue, I copied it in.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the conn.execute entry point and reproduce the two single-statement and multi-statement examples against the reported asyncpg 0.30 and Python 3.11 setup. Done would require an agreed behavior or documentation change for execute's return value; the issue does not name a file or test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100