Python: Create Sql raw query with In clause with list data
问题 Recently I stuck for a moment while preparing the raw Sql Query having In clause to it and the In clause data is a python list . Okay Let me put my example here. Sql Query that I wanted sql_query = 'SELECT * FROM student WHERE first_name IN ("Dean");' From the data I was having data = ["Dean"] query = 'SELECT * FROM student WHERE first_name IN %s;' % str(tuple(data)) # result was "SELECT * FROM student WHERE first_name IN ('Dean',) " # see the *Comma* just before close parentheses which is a