I have a list of strings of format:
cols = ['col1', 'col2', 'col3', 'col4']
converting the above to tuple(cols) gives me:
('col1', 'col2', 'col3', 'col4')
but I need them without quotes, (col1, col2, col3, col4)
Reason why is I use the above in postgres query like:
UPDATE table SET (col1,col2,col3,col4)=('v1','v2','v3','v4') where id = 99
Using with quotes gives syntax error
What exactly I have before send the query:
sql_stmt = 'UPDATE public.sample_table SET %s = %s ' + where_clause
logger.info(cur.mogrify(sql_stmt,(columns,values)))
which logs:
"UPDATE public.sample_table SET ('col1', 'col2', 'col3', 'col4') = ('v1', 'v2', 'v3'::timestamp, 'v4') WHERE col1 IN ('ABC',) AND col2 IN ('ASDF', 'BSDF')"