When I try adding 2 columns, my query works fine
('INSERT INTO TABLE (JSON_S, LOAD_DATE) SELECT PARSE_JSON(?), CURRENT_TIMESTAMP', [[content]] )
However, when I try to add another variable (string):
('INSERT INTO TABLE (JSON_S, LOAD_ID, LOAD_DATE) SELECT PARSE_JSON(?), (?), CURRENT_TIMESTAMP', [[content]], load_id)
I get an error that:
Bind variable ? not set.
What's the correct syntax?
CodePudding user response:
Arguments should be provided as tuple:
con.cursor().execute("INSERT INTO TABLE (JSON_S, LOAD_ID, LOAD_DATE) SELECT PARSE_JSON(?), ?, CURRENT_TIMESTAMP()"
,(content, load_id))