79305348

Date: 2024-12-24 10:38:33
Score: 1.5
Natty:
Report link

Alternate soluton is to use python string replacement - and then pass the full query string. Provided you know the dynamically generated comma separated string or can build it.

Python code: query = " select * from students where name in (%s);"

#some for loop which will create below string students_list_str = 'MUSK', 'TRUMP'

query_str = query%(students_list_str) #Now query_str = " select * from students where name in ('MUSK', 'TRUMP');"

cursor.execute(query_str)

Reasons:
  • No code block (0.5):
  • Low reputation (1):
Posted by: vernekap