Search for the latest rows in terms of timestamp
<p>I am looking for how to search for the latest rows in hbase table that is loaded by Nutch 2.3. </p>

<p>I use happybase and thrift, the only example I have found is in this link <a href="https://happybase.readthedocs.io/en/happybase-0.4/tutorial.html#using-table-namespaces" rel="nofollow">https://happybase.readthedocs.io/en/happybase-0.4/tutorial.html#using-table-namespaces</a></p>

<p>I dont know python so Im explaining this in hbase shell..
More or less you should be able to do this in python.</p>

<h3>Python way : <a href="http://stackoverflow.com/questions/12458595/convert-timestamp-since-epoch-to-datetime-datetime">Convert timestamp since epoch to datetime.datetime</a></h3>

<blockquote>
  <h3>How to get latest timestamp to pass in the filter ?</h3>
  
  <p>LOG data to timestamp
  To convert the date '08/08/16 20:56:29' from an hbase log into a
  timestamp, do:</p>
</blockquote>

<pre><code>     hbase(main):021:0&gt; import java.text.SimpleDateFormat
                   hbase(main):022:0&gt; import java.text.ParsePosition
                    hbase(main):023:0&gt; SimpleDateFormat.new("yy/MM/dd HH:mm:ss").parse("08/08/16 20:56:29", ParsePosition.new(0)).getTime()
 =&gt; 1218920189000
</code></pre>

<p>after above you can try something like this:</p>

<pre><code>scan 't1', {COLUMNS =&gt; 'c1', TIMERANGE =&gt; [1303668804, 1303668904]}


hbase(main):001:0&gt; scan
</code></pre>

<p>Here is some help for this command:
Scan a table; pass table name and optionally a dictionary of scanner
specifications.  Scanner specifications may include one or more of:
TIMERANGE, FILTER, LIMIT, STARTROW, STOPROW, TIMESTAMP, MAXLENGTH,
or COLUMNS, CACHE</p>

<h3>Some examples:</h3>

<pre><code>  hbase&gt; scan '.META.'
  hbase&gt; scan '.META.', {COLUMNS =&gt; 'info:regioninfo'}
  hbase&gt; scan 't1', {COLUMNS =&gt; ['c1', 'c2'], LIMIT =&gt; 10, STARTROW =&gt; 'xyz'}
  hbase&gt; scan 't1', {COLUMNS =&gt; 'c1', TIMERANGE =&gt; [1303668804, 1303668904]}
  hbase&gt; scan 't1', {FILTER =&gt; "(PrefixFilter ('row2') AND (QualifierFilter (&gt;=, 'binary:xyz'))) AND (TimestampsFilter ( 123, 456))"}
  hbase&gt; scan 't1', {FILTER =&gt; org.apache.hadoop.hbase.filter.ColumnPaginationFilter.new(1, 0)}
</code></pre>

python hadoop hbase nutch happybase