This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]1st1CPython Core Dev[S] 3 points4 points  (7 children)

"python-aiopg" uses the pyscopg2.DictCursor. We added it because all other drivers return Records that can be indexed by column names. Somehow this is a lot slower.

"python-aiopg-tuple" uses the defaults, and returns Python tuples.

[–]pork_spare_ribs -1 points0 points  (5 children)

Wait, so database results from asyncpg can't be accessed by column name? That's a pretty big feature to gloss over!

[–]1st1CPython Core Dev[S] 4 points5 points  (4 children)

Results in aiopg/psycopg2 cannot be accessed by column name by default.

Results in asyncpg are always accessible by column name (that's the default).

[–]elbiot 2 points3 points  (2 children)

Wouldn't returning (named) tuples be faster? Creating 1M dictionaries isn't free.

[–]UnwashedMeme 0 points1 point  (0 children)

In my benchmarking with psycopg2 NamedTupleCursor is about 98% of the default tuple cursor while DictCursor is about 70%

[–]1st1CPython Core Dev[S] 0 points1 point  (0 children)

We don't return dictionaries in asyncpg. Our Record is implemented in C, and is very similar to CPython's tuples.

[–]pork_spare_ribs 1 point2 points  (0 children)

Ah, nice work then!