Another MySQL Question
Victor Subervi
victorsubervi at gmail.com
Thu Jun 3 12:57:37 EDT 2010
On Thu, Jun 3, 2010 at 12:25 PM, MRAB <python at mrabarnett.plus.com> wrote:
> So our_options is a list containing two values, which you're putting
> into a tuple:
>
> >>> our_options = ["first", "second"]
> >>> print len(our_options)
> 2
> >>> value_tuple = (our_options,)
> >>> print len(value_tuple)
> 1
> >>>
>
> In other words, value_tuple is a tuple which contains one value, a list.
>
Understood. So I tried this (to include the other values):
sql_string = 'insert into tmp%s values (%s, %s, %s, "%s")' %
(tmpTable, store, prodid, pkg, our_options_string[:-4])
sql = 'insert into tmp%s values (%%s, %%s, %%s, %%s)' % tmpTable
cursor.execute(sql, (store, prodid, pkg, our_options))
Which, of course, gives me the same error, because I'm still putting in the
same len for the final value. What do now?
TIA,
beno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100603/5fa714e1/attachment-0001.html>
More information about the Python-list
mailing list