I have a python list, say l
l = [1,5,8]
I want to write a sql query to get the data for all the elements of the list, say
s
l = [1] # or [1,2,3] query = "SELECT * FROM table WHERE id IN :l" params = {'l' : tuple(l)} cursor.execute(query, params)
The :var notation seems simpler. (Python 3.7)
:var