If you have a list of values that you would like to convert into a set of rows in postgresql, you can use the unnest
function:
values = ['foo', 'bar']
result = cur.execute(
'''
SELECT unnest(%(values)s)
''',
{
'values': ['foo', 'bar']
}
)
print(result.fetchall())
This will output:
>>> print(result.fetchall())
[('foo',), ('bar',)]