Menu

Conversion from None to NULL not working?

Help
crys
2010-09-07
2012-09-19
  • crys

    crys - 2010-09-07

    Hi,

    it seems I'm havong problems with a executemany() call when None values are
    involved. The statement looks like this:

    cursor.executemany(""" INSERT INTO table VALUES (%s,%s,%s,%s,%s) """, tuples)

    The last column in table is of float type. In case a tuple-entry contains a
    'None', a mysql warning is raised like

    Warning: Data truncated for column 'rmsd_calpha' at row 1

    Then, the value 0 is inserted instead of a NULL.

    If I do a simple execute() with a None value involved, the conversion to a
    MySQL NULL works fine.

    Am I doing something wrong here? Or is this a bug?

    Thanks,

    Chris

     
  • crys

    crys - 2010-09-07

    Sorry, please forget what I just wrote. Sorry for the uproar.

     

Log in to post a comment.