sqlite autoincrement of primary key

tinauser tinauser at libero.it
Mon Nov 29 14:25:34 EST 2010


On Nov 29, 7:28 pm, Tim Harig <user... at ilthio.net> wrote:
> On 2010-11-29, tinauser <tinau... at libero.it> wrote:
>
> > '''
> > INSERT INTO 'foo' VALUES (?,?)
> > '''
> > ,('NULL','yyy'))
>
> s/'NULL'/None/
>
> > I get a datatype mismatch error.
>
> The sqlite module is smart enough to convert between Python types and
> Sqlite types.  If you pass it 'NULL' it thinks you are passing it a string.
> Python uses None in much the same way that databases use NULL, so the
> module converts None to 'NULL' and vise versa.

Thanks all of you for the fast answers!



More information about the Python-list mailing list