Executemany on pyodbc only return result from last parameter
<p>I have a problem when I try to use pyodbc executemany function.
I have an Oracle database and I want to extract data for multiple days.</p>

<p>I cannot use between in my request, because the database is not indexed on the date field and its taking forever.
I want to manually ask all day and process answers.
I cannot thread this part, so I wanted to use <code>executemany</code> to get rows more quickly.</p>

<p>The problem is when I use <code>executemany</code> I only got the result of the last argument asked.</p>

<p>Here is my code:</p>

<pre><code>import pyodbc

conn = pyodbc.connect('DRIVER={Oracle in instantclient_11_2};DBQ=dbname;UID=uid;PWD=pwd')
cursor = conn.cursor()
query = "SELECT date FROM table WHERE date = TO_DATE(?, 'DD/MM/YYYY')"
query_args = (
                 ('29/04/2016',),
                 ('28/04/2016',),
)
cursor.executemany(query, query_args)
rows = cursor.fetchall()
</code></pre>

<p>In rows, I can only find rows with <code>(datetime.datetime(2016, 4, 28, 0, 0), )</code>.
Always the last argument.</p>

<p>I am using python 2.7.9 from WinPython on a Oracle database with a client on 11.0.2.
Except this query, every other query is perfectly fine.</p>

<p>I cannot use <code>IN ()</code> synthax for 2 reasons:</p>

<ul>
<li><p>I want to limit operations on database side, and do most of thing on script side (I've tried but it's way too long)</p></li>
<li><p>I might have more than 1000 different dates in the request.</p></li>
</ul>

<p>(Right now I'm using IN() OR IN() OR IN()... but if anyone find something better that would be wonderful !)</p>

<p>Am I doing something wrong ?</p>

<p>Thanks for helping.</p>