Python and psychopg2 - raw sql select from table with integer criteria
<p>It should be simple, bit I've spent the last hour searching for the answer. This is using psychopg2 on python 2.6. </p>

<p>I need something like this:</p>

<pre><code>    special_id = 5
    sql = """
          select count(*) as ct,
            from some_table tbl
           where tbl.id = %(the_id)
      """
cursor = connection.cursor()
cursor.execute(sql, {"the_id" : special_id})
</code></pre>

<p>I cannot get this to work. Were <code>special_id</code> a string, I could replace <code>%(the_id)</code> with <code>%(the_id)s</code> and things work well. However, I want it ot use the integer so that it hits my indexes correctly. </p>

<p>There is a surprising lack of specific information on psychopg2 on the internet. I hope someone has an answer to this seemingly simple question. </p>
