Created
November 25, 2014 22:30
-
-
Save rbm/7ef5106f1e81bd5b824e to your computer and use it in GitHub Desktop.
Dump HBase schema creation statements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include Java | |
import org.apache.hadoop.hbase.HBaseConfiguration | |
import org.apache.hadoop.hbase.client.HTable | |
conf = HBaseConfiguration.new | |
jrb_tables = list() | |
hbase_tables = jrb_tables.map { |jt| HTable.new(conf, jt) } | |
hbase_tables.each do |tbl| | |
desc = tbl.getTableDescriptor() | |
name = desc.nameAsString() | |
fams = desc.getFamilies().toArray() | |
famstrs = fams.map { |fam| fam.toString() } | |
print "create '#{name}', #{famstr.join(', ')}" | |
print "\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment