I have a dictionary of column name / values, to insert into a table. I have a function that generates the INSERT
statement. I'm stuck because the function always puts quotes around the values, and some are integers.
e.g. If column 1 is type integer then the statement should be INSERT INTO myTable (col1) VALUES 5;
vs
INSERT INTO myTable (col1) VALUES '5';
second one causes an error saying column 5 does not exist.
EDIT: I found the problem (I think). the value was in double quotes not single, so it was "5"
.
In Python, given a table and column name, how can I test if the INSERT
statement needs to have ''
around the VALUES
?