Help with MySQLdb insert with data extracted from odbc <-- Oracle

candiazoo at attbi.com candiazoo at attbi.com
Sat Jun 22 09:41:03 EDT 2002


Ah!  Thank you!

Mike J.

On Sat, 22 Jun 2002 04:17:58 +0200, Gerhard =?iso-8859-15?Q?H=E4ring?=
<gerhard.haering at gmx.de> wrote:

>* candiazoo at attbi.com <candiazoo at attbi.com> [2002-06-22 01:43 +0000]:
>> Can someone tell me what this means?  I mean, I guess I *know* what it means,
>> but why?
>> 
>> The insert statement into a mysql database is...
>> 
>> 'insert into works values(?, ?, ?, ?, ? ,?)'
>
>Wrong. paramstyle = 'format' in MySQLdb, not 'qmark'. Look into the
>DB-API specs (PEP 0249) for details about the various paramstyles that
>are possible.
>
>> The invocation of the dynamic sql is...
>> 
>>     status = cur_mysql.execute(sql, 
>>         (wrk_inst, ZERO, trs_inst, aas_inst, title, NADA))
>
>Simply use %s instead of ?. And read the fine MySQLdb docs that are
>included :-)
>
>Gerhard
>
>PS: I don't like these sort of spam protection attempts.
>-- 
>mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
>web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id AD24C930
>public key fingerprint: 3FCC 8700 3012 0A9E B0C9  3667 814B 9CAA AD24 C930
>reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
>
>




More information about the Python-list mailing list