mysqldb - parameter issue

bruce badouglas at gmail.com
Wed Aug 11 19:29:29 CEST 2010


hey dennis...

umm.. given that i'm building the ins var/string to insert into the
execute... i can't just place the triple quotes around it..

are you saying that the execute should have quotes placed around it
within the execute
so it would be something like
 execute("\""+sel""\""...

or are you saying that within python i can just extend the line for
the "sel" on multiple lines..

as to the err.
  i'm getting a " >>> Warning: Data truncated for column

it appears that if i place the >>from_unixtime(%s) << at the end of
the paramaters, then everything works.. but if i place it within the
"%s" block.. the error is generated.

I'm assuming there's some way to wrap the from_unixtime(%s) so it
could be used as

%s,%s,%s, from_unixtime(%s), %s, %s,...

in checking the docs/spec.. i didn't see anything that discussed this...

thanks


>        ins = """insert into functionError_TBL
>                                        (errorStatus, CollegeID, processTime)
>                        values (%s, %s, from_unixtime(%s) )"""
>


On Wed, Aug 11, 2010 at 9:53 AM, Dennis Lee Bieber
<wlfraed at ix.netcom.com> wrote:
> On Wed, 11 Aug 2010 08:08:21 -0700, bruce <badouglas at gmail.com>
> declaimed the following in gmane.comp.python.general:
>
>
>>   tlist= [(1, 1, 1281502771)]
>>
>>   ins="insert into functionError_TBL "
>>   ins=ins+"(errorStatus, CollegeID, processTime)"
>>   ins=ins+" values "
>>   ins=ins+"  (%s,%s,  from_unixtime(%s))"
>
>        Without examining the rest of the problem, the above sequence can be
> cleaned up by using triple quotes...
>
>        ins = """insert into functionError_TBL
>                                        (errorStatus, CollegeID, processTime)
>                        values (%s, %s, from_unixtime(%s) )"""
>
>>
>> along with the corresponding insert portion, and the test list, an
>> error is generated..
>>
>        What error? You've failed to post the most important part... EXACTLY
> what the system reports...
> --
>        Wulfraed                 Dennis Lee Bieber         AF6VN
>        wlfraed at ix.netcom.com    HTTP://wlfraed.home.netcom.com/
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list