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
Just use inline if operation with tuple function:
query = "Select * from hr_employee WHERE id in " % tuple(employee_ids) if len(employee_ids) != 1 else "("+ str(employee_ids[0]) + ")"