0
for key, data in table.scan():
print('Found: {}, {}'.format(key, data))

I have an HBase table that I need to scan and print the timestamp. I have written the above code but it only produces output like...

Found: b'row1', {b'cf1:col':(b'value')}

But I want output like...

Found: b'row1', {b'cf1:col':(b'value', timestamp)}

Any idea guys?

ffl
  • 91
  • 1
  • 4

1 Answers1

0

By default, HBase does not include timestamps in the results you return. You can use HappyBase to retrieve them. To get them, your application needs to have timestamps_include,

row = table.row(b'row-key', columns=[b'cf1:col1'], include_timestamp=True)
value, timestamp = row[b'cf1:col1']

And after that, you can use,

for key, data in table.scan(include_timestamp=True):
   print('Found: {}, {}'.format(key, data))
Nipuna Upeksha
  • 348
  • 3
  • 15