- attached patch.diff
Inserting multiple values doesn't work in some cases
inserting multiple rows using single list of row values doesn't work, ex.
conn.execute("insert into users (user_id, user_name) values (?, ?)", [(10,"donkey")]((9,"barney"),))
or
conn.execute("insert into users (user_id, user_name) values (%s, %s)", [[4,"ed"]([4,"ed"), [5,"horse"](5,"horse")])
Attached patch fixes this.
Comments (4)
-
Account Deleted -
repo owner - marked as major
why not follow what the method docstring says (or intends to say, in which case its just a doc fix) ?
in the case of 'raw' execution which accepts positional parameters, it [being *multiparams](it) may be a list of tuples or lists.
__distill_params()
is already quite a beast, and we'd be better off not being so agnostic in the params we accept. Also it's unclear if this would work with the PG ARRAY type. I'm even +1 on reducing the *multiparams to only accept a list of tuples or dicts. -
repo owner - changed status to wontfix
sorry, the attached patch also creates a ton of errors in the unit tests due to the extra ambiguity presented in the API, so TMTOWTDI + it actually breaks things pretty much kills this one for me.
-
Account Deleted It would be nice then to mention somewhere in the docs that
execute
accepts list of dicts but not list of tuples or lists. Thanks for looking into this anyway. - Log in to comment
patch for __distill_params and test