1

Can someone help me with the stacktrace generated while using happybase library? I am trying to pass a dictionary object of python 3.4 in the 'put' method and the following stack trace is generated::

x
b"TWLb'25-Jan-13'"
data_values
{b'Low': b'0.10', b'Date': b'25-Jan-13', b'Volume': b'-', b'Close': b'0.12', b'High': b'0.12', b'Open': b'0.12'}
Traceback (most recent call last):
  File "/home/msingal/Desktop/asd/Daily.py", line 63, in insert
    hbase_test.insert_data(code, data_format)
  File "/home/msingal/Desktop/asd/hbase_test.py", line 56, in insert_data
    con.table(ticker, use_prefix=False).put(x, data_values)
  File "/usr/lib/python3.4/site-packages/happybase/table.py", line 464, in put
    batch.put(row, data)
  File "/usr/lib/python3.4/site-packages/happybase/batch.py", line 137, in __exit__
    self.send()
  File "/usr/lib/python3.4/site-packages/happybase/batch.py", line 60, in send
    self._table.connection.client.mutateRows(self._table.name, bms, {})
  File "/usr/lib64/python3.4/site-packages/thriftpy/thrift.py", line 198, in _req
    return self._recv(_api)
  File "/usr/lib64/python3.4/site-packages/thriftpy/thrift.py", line 210, in _recv
    fname, mtype, rseqid = self._iprot.read_message_begin()
  File "thriftpy/protocol/cybin/cybin.pyx", line 429, in cybin.TCyBinaryProtocol.read_message_begin (thriftpy/protocol/cybin/cybin.c:6325)
  File "thriftpy/protocol/cybin/cybin.pyx", line 60, in cybin.read_i32 (thriftpy/protocol/cybin/cybin.c:1546)
  File "thriftpy/transport/buffered/cybuffered.pyx", line 65, in thriftpy.transport.buffered.cybuffered.TCyBufferedTransport.c_read (thriftpy/transport/buffered/cybuffered.c:1881)
  File "thriftpy/transport/buffered/cybuffered.pyx", line 69, in thriftpy.transport.buffered.cybuffered.TCyBufferedTransport.read_trans (thriftpy/transport/buffered/cybuffered.c:1948)
  File "thriftpy/transport/cybase.pyx", line 61, in thriftpy.transport.cybase.TCyBuffer.read_trans (thriftpy/transport/cybase.c:1472)
  File "/usr/lib64/python3.4/site-packages/thriftpy/transport/socket.py", line 125, in read
    message='TSocket read 0 bytes')
thriftpy.transport.TTransportException: TTransportException(message='TSocket read 0 bytes', type=4)

The lines of code are::

ticker = 'TWLB'
data_values = {b'Low': b'0.10', b'Date': b'25-Jan-13', b'Volume': b'-', b'Close': b'0.12', b'High': b'0.12', b'Open': b'0.12'}
x = (ticker + str(data_values.get(b'Date'))).encode('ASCII')
print('x')
print(x)
print('data_values')
print(data_values)
con.table(ticker, use_prefix=False).put(x, data_values)

Any help on solution and explaination would be apprciated. I am new to StackOverflow so if my language feels offencive, please forgive me. I have tried to provide all the relevant info but if some info is missing let me know and I will update.

Mudit Singal
  • 133
  • 1
  • 7
  • The problem I believe is with the way 'put' method converts python dictionary to java object, after observing stacktrace generated by HBsae thrift server. – Mudit Singal Jan 28 '18 at 11:38
  • you might be sending the wrong data format. missing column family in your data i think. – wouter bolsterlee Feb 20 '18 at 11:18
  • my data format and data is as specified by 'data_values' and as specified by the 'Storing Data' header in 'https://happybase.readthedocs.io/en/latest/user.html' I do think I am doing it right, but please let me know if something is wrong. As for the column families, the happybase docs does not mention providing column familes while getting connection to a table. – Mudit Singal Feb 22 '18 at 07:24

0 Answers0