Dear Wiki user, You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.
The following page has been changed by AndreiSavu: http://wiki.apache.org/hadoop/Hbase/Jython ------------------------------------------------------------------------------ }}} == Another Sample == - {{{# Print all rows that are members of a particular column family + {{{# Print all rows that are members of a particular column family - # by passing a regex for family qualifier (HQL does not support + # by passing a regex for family qualifier - # - # To run this script, I did the following: + import java.lang - # $ HBASE_OPTS="-Dpython.path=$JYTHON_HOME" HBASE_CLASSPATH=$JYTHON_HOME/jython.jar ./bin/hbase org.python.util.jython select.jython - # - from org.apache.hadoop.hbase import HBaseConfiguration, HTable, HStoreKey - from org.apache.hadoop.io import Text - from java.util import TreeMap - from jarray import array + from org.apache.hadoop.hbase import HBaseConfiguration + from org.apache.hadoop.hbase.client import HTable + - c = HBaseConfiguration() + conf = HBaseConfiguration() + + table = HTable(conf, "wiki") + col = "title:.*$" + + scanner = table.getScanner([col], "") - t = HTable(c, Text("enwiki_080103")) - b = Text("title:.*$") - columns = array([a], Text) - scanner = t.obtainScanner(columns, Text("")) - key = HStoreKey() - value = TreeMap() while 1: - result = scanner.next(key, value) + result = scanner.next() if not result: break - print key}}} + print java.lang.String(result.row), java.lang.String(result.get('title:').value) + }}} +
