title: Executing SQL Server stored procedures with parameters in Python
body: <p>I'm trying to execute a stored procedure to query a table, and am having trouble passing through a parameter successfully. </p>
  
  <pre><code>title=cursor.execute("SELECT titlequery(%s)", str(member_id))`
  </code></pre>
  
  <p><code>titlequery()</code> is created by this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>CREATE OR REPLACE FUNCTION public.titlequery(mid text)
    RETURNS text AS
  $BODY$
  
   SELECT title FROM Member WHERE member_id=mid;
  
  $BODY$
    LANGUAGE sql</code></pre>
  </div>
  </div>
  </p>
  
  <p>And the error I'm getting:</p>
  
  <blockquote>
    <p>modules.pg8000.core.ProgrammingError: ('ERROR', '42P18', 'could not
    determine data type of parameter $2', 'postgres.c', '1356',
    'exec_parse_message', '', '')</p>
  </blockquote>
  
  <p>Does anyone know what's happening here?</p>