title: In SQLAlchemy, how do I query composite primary keys?
body: <p>I'm using SQLAlchemy to programmatically query a table with a composite foreign key. e.g.:</p>
  
  <pre><code>CREATE TABLE example (
  id INT NOT NULL,
  date TIMESTAMP NOT NULL,
  data VARCHAR(128)
  PRIMARY KEY (id, date)
  )
  </code></pre>
  
  <p>I'd like to take a list of values and get rows back e.g.:</p>
  
  <pre><code>interesting_data = (
      (1, '2016-5-1'), 
      (1, '2016-6-1'),
      (2, '2016-6-1'),
      (3, '2016-5-1'),
      (3, '2016-6-1'),
  )
  select(
      [example.c.id, example.c.date, example.c.data],
  ).where(example.primary_key.in_(interesting_data)
  </code></pre>
  
  <p>If each column was independent I could do </p>
  
  <pre><code>interesting_ids = [1,2,3]
  interesting_dates = ['2016-5-1', '2016-6-1']
  select(
      [example.c.id, example.c.date, example.c.data],
  ).where(
      example.c.id.in_(interesting_ids)
  ).where(
      example.c.date.in_(interesting_dates)
  )
  </code></pre>
  
  <p>But that clearly fails to bring only the unique matching (id, date) tuples. I suspect there is a way to specify the compound primary key to query, but I can't find any documentation after a search.</p>