Here is a part of my script :
sql1 = """
SELECT distinct th.name, 'MMS' as Status
FROM t1
JOIN t2 on t1.id = t2.tid
WHERE t2.station= 'MatS'
AND t1.name IN ({listthinglist})
""".format(listthinglist=', '.join("'" + item + "'" for item in list_of_things))
cur.execute(sql1)
The list_of_things contains 22016 items and I am unable to run this query in python. Is there an alternative to run queries like this in python.