nakagami / pydrda

Pure python Db2 and Apache Derby database driver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Max DSS Size

raphgauthier opened this issue · comments

Hi,

i have encountered an error while querying in a large database. When I run

cur.execute(""" SELECT <col> FROM <table> """)

I get the following error :

AssertionError                            Traceback (most recent call last)
<ipython-input-3-592b61ee4a58> in <module>
   1 cur = connection.cursor()
   2 try:
----> 3     cur.execute(""" SELECT <col> FROM <table> """)
   4 except drda.OperationalError:
   5     pass

/opt/conda/lib/python3.7/site-packages/drda/cursor.py in execute(self, query, args)
  60         self.query = query32776
  61         if query.strip().split()[0].upper() == 'SELECT':
---> 62             self._rows, self.description = self.connection._query(self.query, args)
  63         else:
  64             self.connection._execute(self.query, args)

/opt/conda/lib/python3.7/site-packages/drda/connection.py in _query(self, query, args)
 364                 cur_id, False, True
 365             )
--> 366             rows, description, params_description = self._parse_response()
 367             return rows, description
 368 

/opt/conda/lib/python3.7/site-packages/drda/connection.py in _parse_response(self)
  45         err_msg = None
  46         while chained:
---> 47             dds_type, chained, number, code_point, obj = ddm.read_dds(self.sock)
  48             print("dds_type:", dds_type, "chained:", chained, "number:", number, "code_point:", code_point)
  49             if code_point == cp.SQLERRRM:
sql
/opt/conda/lib/python3.7/site-packages/drda/ddm.py in read_dds(sock)
 239     print("b[3]", b[3])
 240 
--> 241     assert int.from_bytes(obj[:2], byteorder='big') == ln - 6
 242     code_point = int.from_bytes(obj[2:4], byteorder='big')
 243 

AssertionError:

At the time it fails into AssertionError, obj[:2] is equal to 32776, and ln to 65535.

Here is the Server Trace file. I am not expert in DRDA protocol at all, but I guess that the server has to send more data than a single DSS can contain, so it cuts it in multiple parts as described in DssProtocolErrors. Is it correct?

please show me create table statement example.
And fill and

When the error occurred, there was a combination of this assertion being False, although it was different from the value you pointed out.
I removed the assert statement and got the expected behavior, so I will remove the assert statement.