MySQL Problem

Victor Subervi victorsubervi at gmail.com
Fri Sep 3 15:37:15 CEST 2010


On Fri, Sep 3, 2010 at 9:25 AM, Richard Arts <arts.richard at gmail.com> wrote:

> These are also mere suggestions.
>
> The statements you use in your print statement and the one you use to
> feed the cursor differ slightly. The latter is missing quotes around
> your search criterium.
>
> Isn't it possible to fetch results row by row and see if the missing
> row is in the set? That way you can get a better feeling about the
> nature of the error.
>

Well, I just tried, out of curiosity,  inserting 0 instead of 1 and guess
what? It shows up. So by simply changing that my problem is solved...but I
sure as heck would like to know why!

>
> > cursor.execute('insert into spreadsheets values (Null, %s, 0, %s, 0,
> Null)', (client, prod))
>
> Out of curiosity, why would you want to insert null values in id
> fields? That's a disaster waiting to happen.
>

Hardly. This is the standard way of inserting into auto_increment fields.
That triggers the auto_increment! That makes it much easier to insert the
correct value of the field.
beno
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100903/dc1b87a0/attachment.html>


More information about the Python-list mailing list