aio-libs / aio-libs/aiopg

Broken aiopg.sa.RowProxy unpacking

Open
#441 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
170
PR merge metrics
No merged PRs in 30d

Description

So RowProxy doesn't behave like the SQLAlchemy one, I find it really misleading.

```entry = {
'dtid': dtid,
'username': username,
}

query = psa.insert(User) \
.values(entry) \
.returning(User.c.id) \
.on_conflict_do_update(
index_elements=[User.c.dtid],
set_=entry
)
user_id = await (await conn.execute(query)).first()
print(type(user_id), user_id) # Output: " (1,)"
print(user_id[0]) # Output: " 1"
user_id, = user_id
print(user_id) # Output: " id"
```

As you see, everything goes well until I try to unpack the row...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.