NULL vs. None and MySQLdb
Aahz Maruch
aahz at panix.com
Tue Sep 19 12:00:08 EDT 2000
In article <39c705e1.115957469 at news.alaska.net>,
Geoffrey L. Wright <geoff.nospam at northernwastes.org> wrote:
>On 18 Sep 2000 19:15:07 -0700, aahz at panix.com (Aahz Maruch) wrote:
>>
>>None is the Python equivalent of NULL; what's wrong with None?
>
>Well ... I'm passing the the result contents of str(row) strait back
>to MySQL -- so that my SQL literally ends up reading something like:
>
> INSERT INTO tableName
> (column1, column2, column3, column4)
> VALUES
> ('ohNo', 'hereIt', 'comes', None)
>
>And the problem is the MySQL chokes on the unquoted "None", whereas it
>would just treat NULL as ... well ... NULL.
If that's all you're doing, why make the Python round-trip? Doesn't
MySQL have a way to do something like
INSERT INTO x (col1, col2, col3)
SELECT col1, col2, col3
FROM y
WHERE col4 = 'foo'
Note that I know nothing about MySQL in specific.
--
--- Aahz (Copyright 2000 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
The best way to get information on Usenet is not to ask a question, but
to post the wrong information. --Aahz
More information about the Python-list
mailing list