I have a table, let's say:
id | value
1 | 'a'
2 | 'b'
Where for some ID's value might be missing. If I use iterative solution, for example:
for item in my_array:
data = cursor.execute("""SELECT id from table WHERE value = 'a'""")
If there is no 'a' in DB I get None and can handle it, so for each item I have at least None. But what if I want to do all at once, like:
"""SELECT id from table WHERE value = ANY(array['a', 'b', 'c', 'd'])"""
So I need 4 responses (including None for missing data), while it gives me response only for present data