Give an array like this:
my_array = [2,3,5,23,4]
and a table like this:
column1 | column2
---------+----------
1 |
2 |
3 |
4 |
5 |
How can I insert the array values into a table. Roughly I want to do something like this with SQL:
for item in my_array:
UPDATE my_table SET colum2 = item
The updated table should be like this
column1 | column2
---------+----------
1 | 2
2 | 3
3 | 5
4 | 23
5 | 4
UPDATE: I am using Python psycopg2 but I am wondering if there is a way with pure SQL.