Passing arguments to executemany

Asked by Giovanni Luca Ciampaglia

Hi,
I switched from MySQLdb to oursql and I very happy with it. I just tried using executemany for this query

query="""
select unix_timestamp(rev_timestamp)/86400.0, page_namespace
from revision r join page p
on r.rev_page = p.page_id
where rev_user = ?
order by rev_timestamp
"""

In my script I call it in the following fashion:

executemany(query, [(10,), (20,)])

But I get the following error:

 ---------------------------------------------------------------------------
ProgrammingError Traceback (most recent call last)
/home/giovanni/repos/lifecycle.git/<ipython-input-9-0f01344bcf0c> in <module>()
----> 1 cursor.executemany(query, [(20,), (10,)])

/usr/local/lib/python2.7/dist-packages/oursql.so in oursql.Cursor.executemany (oursqlx/oursql.c:16181)()

/usr/local/lib/python2.7/dist-packages/oursql.so in oursql._Statement.execute (oursqlx/oursql.c:8976)()

ProgrammingError: (None, 'executing this query would cause rows to become unfetchable', None)

*************

what does it mean? I am using oursql 0.9.2 on Python 2.7 Ubuntu 11.04.

Cheers

G

Question information

Language:
English Edit question
Status:
Expired
For:
oursql Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Giovanni Luca Ciampaglia (gciampaglia) said :
#2

Il 19. 08. 11 02:11, Launchpad Janitor ha scritto:
> Your question #166877 on oursql changed:
> https://answers.launchpad.net/oursql/+question/166877
>
> Status: Open => Expired
>
> Launchpad Janitor expired the question:
> This question was expired because it remained in the 'Open' state
> without activity for the last 15 days.
>

--
Giovanni Luca Ciampaglia
Wikimedia Foundation
Summer Research Fellow

mobile: 415-525-6124

Revision history for this message
Launchpad Janitor (janitor) said :
#3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Stephen Thorne (jerub) said :
#4

Hi, I just had a look at this problem.

What are you expecting here? If you call executemany() with a select query, you're selecting data and throwing it away immediately..

This error message is saying you've not looked at your result set before doing another query.