title: Parametized sql query with two parameters one of which is a collection of lists
body: <p>I have large databases for which I am using an sql query in python to write the data to csv files. In the sql database each row is a series of spatial information for a finger ID. I can parametize the query for to get the information and write the files I need for each finger. However, the problem arises in creating a functional for loop that iterates over each ID for all the indexes in the list.</p>
  
  <pre><code>INDEX = ([44,48,50,55,56,57], [49,54,57,61,62,64])
  
  
  FINGER = ('rt100', 'rt101')
  
  d = {}
  for Y,X in FINGER, INDEX:
      d[Y] = pd.read_sql ("SELECT x,y, CAST( (direction*180/3.142)as INT),CAST(quality*100 as INT) from UTS_7_fingerprints where finger like ? and ind = ?", conn, params=(Y,X,))
  </code></pre>
  
  <p>This is the code I have currently, however I get this error:</p>
  
  <pre><code>pandas.io.sql.DatabaseError: Execution failed on sql 'SELECT x,y, CAST( (direction*180/3.142)as INT),CAST(quality*100 as INT) from UTS_7_fingerprints where finger like ? and ind = ?': Error binding parameter 0 - probably unsupported type.
  </code></pre>
  
  <p>Even using trying the loop for a single ID and a single list of indexes I get the error that there are too many values to unpack.
  I can't seem to find a way to include a list of lists within the SQL statement.</p>
  
  <p>To be clear as to what I'm trying to do. I need to iterate through ID's such as 'rt100' for each Index in the lists ' [44,48,50,55,56,57]' and getting the data 'SELECT x,y, CAST( (direction*180/3.142)as INT),CAST(quality*100 as INT)' for each Index and ID.
  This produces a .csv file that looks like this:</p>
  
  <pre><code>372,402,281,83
  394,303,303,97
  415,422,123,86
  458,328,292,95
  464,487,112,96
  483,389,303,95
  </code></pre>