Python, Mysql, insert NULL

Pallavi Kale pallavi.kale at bioanalytical.net
Fri Apr 4 06:39:02 EDT 2008


Hello there, 

 

I was going through the thread of conversation happening around inserting
null using python into mysql. 

 

I am facing a similar problem here. I have to insert say 8 values into a
table using a stored procedure. Of the 8 values 2 are not null and the
remaining can be null, most of the values have datatypes as int or float.
When I try to pass null to these using python I keep getting None error from
the sql server.

 

I am using pymssql to talk to the database which is another reason the
parameters that I pass have to be type defined that is say @solutionID = %d
I, where @SolutionID is an integer type. 

 

Have anyone found a way to pass null into sql using python when the variable
is other than string, please let me know I am just learning python so I am
sure there must be a simpler and neater way to do it..

 

 

Thanks :-)

 

Best regards, 

 

Pallavi Kale 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080404/c7c66a8c/attachment.html>


More information about the Python-list mailing list