curs.fetchall() not working

Asked by firefoxtester

I'm doing a curs.execute(<my query>)
and then calling cursor.fetchall()

And I'm getting this traceback:

Traceback (most recent call last):
  File "synch.py", line 119, in <module>
    main()
  File "synch.py", line 115, in main
    run_synch()
  File "synch.py", line 74, in run_synch
    result_rows = source_curs.fetchall()
  File "/usr/lib/python2.7/site-packages/JayDeBeApi-0.1.3-py2.7.egg/jaydebeapi/dbapi2.py", line 326, in fetchall
    row = self.fetchone()
  File "/usr/lib/python2.7/site-packages/JayDeBeApi-0.1.3-py2.7.egg/jaydebeapi/dbapi2.py", line 288, in fetchone
    if not self._rs.next():
TypeError: 'NoneType' object is not callable

Let me know what other information might be useful.

Question information

Language:
English Edit question
Status:
Answered
For:
JayDeBeApi Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
firefoxtester (gregpinero) said :
#1

If it helps I looked into this Cursor class's execute method in dbapi2.py.

Here's the source from that:

    def execute(self, operation, parameters=None):
        if not parameters:
            parameters = ()
        self._close_last()
        self._prep = self._connection.jconn.prepareStatement(operation)
        self._set_stmt_parms(self._prep, parameters)
        is_rs = self._prep.execute()
        self.update_count = self._prep.getUpdateCount()
        if is_rs:
            self._rs = self._prep.getResultSet()
            self._meta = self._rs.getMetaData()
        # self._prep.getWarnings() ???

is_rs is set to 1.

And if I look at self._rs I see:

(Pdb) self._rs
<jpype._jclass.com.filemaker.jdbc3.J3ResultSet object at 0x1e86f10>

So I don't know why this gives me an error:
(Pdb) self._rs.next()
*** TypeError: 'NoneType' object is not callable

Revision history for this message
firefoxtester (gregpinero) said :
#2

Hi guys,

I'll try the branch you mention but I don't think that's the issue. I am doing a select and when I run the exact same query in DB Vizualizer, I get 10s of thousands of records.

Here's the SQL:

select
"_pk_WorkOrder",
"_fk_Job",
"_fk_Phase",
"_fk_RequestType",
"_fk_RequestSubType",
"_fk_RequestSpecificType",
"_fk_Submitter",
"_fk_Department",
"_fk_StaffAssigned",
"_fk_MainRequester",
"_fk_DeptBillTo",
Description,
Status,
cTotal,
BudgetAmount,
"Date_Billed"
"Date_Complete",
"Date_Promised",
DatePromisedRevised,
"Date_Revised",
"Date_Submitted",
AdminCode,
AmountLabor,
AmountMaterial,
HHMIProjectID,
FlagHasBeenSplit
from WorkOrder

Revision history for this message
Bastian (baztian) said :
#3

The reason for this weird behaviour is that your driver's com.filemaker.jdbc3.J3ResultSet class hat got a "next()" method and a "getNext()" method. JPype - the library jaydebeapi uses to access Java classes from CPython - automatically calles getNext() when you access .next to make it more convenient for you to access java properties as you would access python attributes. I don't know how to call the real next method.

Unfortunately I currently don't know an easy way to work around that behaviour of JPype.

Revision history for this message
Bastian (baztian) said :
#4
Revision history for this message
Bastian (baztian) said :
#5

It is fixed in originell's jpype fork https://github.com/originell/jpype/

Can you help with this problem?

Provide an answer of your own, or ask firefoxtester for more information if necessary.

To post a message you must log in.