Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How convert None to NULL with Python 2.7 and pyodbc

I am passing the output from a sql query to again insert the data to ms sql db. If my data is null python / pyodbc is returning None instead of NULL. What is the best way to convert None to NULL when I am calling another query using the same data. Or a basic string transformation is the only way out ? Thanks Shakti

like image 725
Shakti Avatar asked Apr 03 '15 11:04

Shakti


1 Answers

If you use a parameterized query to perform the insert then you won't have to worry about converting None to NULL (among other benefits). See my recent answer to a related question for details.

like image 133
Gord Thompson Avatar answered Oct 25 '22 04:10

Gord Thompson