Skip to content

Commit f9637bb

Browse files
committed
[hbase] Load binary data into HBase
1 parent f2251dc commit f9637bb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

hbase-tables/load_binary.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
##
2+
## Insert various data into HBase
3+
##
4+
5+
## cd $HUE_HOME (e.g. cd /usr/share/hue(/opt/cloudera/parcels/CDH-XXXXX/share/hue if using parcels))
6+
## build/env/bin/hue shell
7+
##
8+
9+
from hbase.api import HbaseApi
10+
11+
HbaseApi().putRow('Cluster', 'events', 'hue-20130801', {'doc:txt': 'Hue is awesome!'})
12+
HbaseApi().putRow('Cluster', 'events', 'hue-20130801', {'doc:json': '{"user": "hue", "coolness": "extra"}'})
13+
HbaseApi().putRow('Cluster', 'events', 'hue-20130802', {'doc:version': '<xml>I like HBase</xml>'})
14+
HbaseApi().putRow('Cluster', 'events', 'hue-20130802', {'doc:version': '<xml>I LOVE HBase</xml>'})
15+
16+
17+
## From https://github.com/romainr/hadoop-tutorials-examples
18+
## cd /tmp
19+
## git clone https://github.com/romainr/hadoop-tutorials-examples.git
20+
21+
root='/tmp/hadoop-tutorials-examples'
22+
23+
HbaseApi().putRow('Cluster', 'events', 'hue-20130801', {'doc:img': open(root + '/hbase-tables/data/hue-logo.png', "rb").read()})
24+
HbaseApi().putRow('Cluster', 'events', 'hue-20130801', {'doc:html': open(root + '/hbase-tables/data/gethue.com.html', "rb").read()})
25+
HbaseApi().putRow('Cluster', 'events', 'hue-20130801', {'doc:pdf': open(root + '/hbase-tables/data/gethue.pdf', "rb").read()})
26+

0 commit comments

Comments
 (0)