MonetDB / pymonetdb

The Python API for MonetDB
https://www.monetdb.org/
Mozilla Public License 2.0
28 stars 20 forks source link

PymonetDB low level MAPI interface: Increase the return array size? #33

Closed krimp closed 5 years ago

krimp commented 6 years ago

I'm using MonetDB Mar2018 release and the low level MAPI Python interface. When requesting data from MonetDB, only 100 records are returned. Executing the same query from the mclient returns 584 records. My code goes like this:

from pymonetdb import mapi mapiCon = mapi.Connection() mapiCon.connect( hostname="localhost", port=50000, username= and so on....) data = mapiCon.cmd(...myQuery...)

My question is: How does one change this 100 limit using the mapi interface?

gijzelaerr commented 6 years ago

this might be related to https://github.com/gijzelaerr/pymonetdb/issues/32. What is the Python code you use to retrieve your results?

krimp commented 6 years ago

The Python (Python 3.5) code is as stated in my opening issue:

from pymonetdb import mapi

mapiCon = mapi.Connection() mapiCon.connect( hostname="localhost", port=50000, username= and so on....) data = mapiCon.cmd("sSELECT .....")

krimp commented 6 years ago

The solution seems to be:
Constrain reply size to 1000 by mapiCon.cmd("Xreply_size 1000")

I.e: from pymonetdb import mapi mapiCon = mapi.Connection() mapiCon.connect( hostname="localhost", port=50000, username= and so on....) mapiCon.cmd("Xreply_size 1000") data = mapiCon.cmd(...myQuery...)

gijzelaerr commented 5 years ago

Sorry for the delay, only found time to look at this now. This is not really unexpected since this is how MAPI works. Still, I'll add a helper function.

gijzelaerr commented 5 years ago

there now is a map.connection.set_reply_size() helper.