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
At ./helper.pyL#63 paramaters contains a tuple of ids for the WHERE condition (WHERE pk in (val1, val2))
when there is only one item to update then the resulting sql ends in WHERE pk in (val1,) so I get (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1")
I know that if I'm not going to update only one object, then I should not use bulk_update but, shouldn't this be capable of handling also a list of only 1 item? or at list handle the error :-)
A code like this on ./helper.pyL#57 fixed the issue for me
iflen(pks) >1:
paramaters.extend([tuple(pks)])
sql='UPDATE {dbtable} SET {values} WHERE {pkcolumn} in %s'\
.format(dbtable=dbtable, values=values, pkcolumn=pkcolumn)
else:
paramaters.extend(pks)
sql='UPDATE {dbtable} SET {values} WHERE {pkcolumn} in (%s)'\
.format(dbtable=dbtable, values=values, pkcolumn=pkcolumn)
I don't know if you like the idea. If you do, then I could do a PR for you
Thanks for this nice tool
The text was updated successfully, but these errors were encountered:
At
./helper.pyL#63
paramaters contains a tuple of ids for the WHERE condition (WHERE pk in (val1, val2)
)when there is only one item to update then the resulting sql ends in
WHERE pk in (val1,)
so I get(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1")
I know that if I'm not going to update only one object, then I should not use bulk_update but, shouldn't this be capable of handling also a list of only 1 item? or at list handle the error :-)
A code like this on
./helper.pyL#57
fixed the issue for meI don't know if you like the idea. If you do, then I could do a PR for you
Thanks for this nice tool
The text was updated successfully, but these errors were encountered: