You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
I get a cryptic KeyError when I tryto use asyncpg's executemany method #807
Thanks, it looks like I misunderstood the argument types. Yes, I think list of dicts, list of lists, and list of tuples should all be supported, but I know what I did wrong now.
Supporting mappings would be confusing, because the iteration is done over keys in Python. It would also be inconsistent with the handling of query arguments in Postgres/asyncpg in general as they're inherently positional.
Activity
elprans commentedon Aug 11, 2021
executemanyexpects a sequence of tuples not mappings. We ought to handle incorrect input data better, of course.salimfadhley commentedon Aug 13, 2021
Thanks, it looks like I misunderstood the argument types. Yes, I think list of dicts, list of lists, and list of tuples should all be supported, but I know what I did wrong now.
elprans commentedon Aug 13, 2021
Supporting mappings would be confusing, because the iteration is done over keys in Python. It would also be inconsistent with the handling of query arguments in Postgres/asyncpg in general as they're inherently positional.
salimfadhley commentedon Aug 18, 2021
yes, perhaps all that's needed is a clearer error message in case the user passes in the wrong type of record?
elprans commentedon Aug 18, 2021
Definitely.
Improve diagnostics of invalid executemany() input
Improve diagnostics of invalid executemany() input