Reputation: 2033
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
Upvotes: 8
Views: 21589
Reputation: 123399
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.
Upvotes: 11
Reputation: 1165
You could overwrite query function in way that None will be replace with "NULL"
Upvotes: -2