You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Sean Busbey (JIRA)" <ji...@apache.org> on 2017/09/20 13:19:00 UTC
[jira] [Commented] (HBASE-15611) add examples to shell docs
[ https://issues.apache.org/jira/browse/HBASE-15611?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16173164#comment-16173164 ]
Sean Busbey commented on HBASE-15611:
-------------------------------------
h3. How can I find tables that are marked with my own custom metadata?
If you have tables that are annotated with some identifying key, e.g.
HBase 1.y Java Admin API:
{code}
try (Admin admin = connection.getAdmin()) {
HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(“my_example_table”) );
htd.addFamily(new HColumnDescriptor(“family1”));
htd.setValue(“my.custom.table.metadata”, “value that only means something to me.”)
admin.createTable(htd);
}
{code}
HBase 2.y Java Admin API:
{code}
try (Admin admin = connection.getAdmin() {
TableDescriptor td = TableDescriptorBuilder.newBuilder(TableName.valueOf(“my_example_table”))
.addColumnFamily(ColumnFamilyDescriptorBuilder.of(“family1”))
.setValue(“my.custom.table.metadata”, “value that only means something to me.”)
.build();
admin.createTable(td);
}
{code}
HBase Shell:
{code}
hbase(main):001:0> create 'some_table', 'family', {METADATA => {"my.custom.table.metadata" => "value that only means something to me."} }
{code}
You can retrieve a list of those tables that have your custom metadata set in the shell via:
{code}
hbase(main):002:0> @hbase.admin(@formatter).list().select do |table|
hbase(main):003:1* not get_table(table).table.get_table_descriptor.get_value(‘my.custom.table.metadata’).nil?
hbase(main):004:1> end
{code}
> add examples to shell docs
> ---------------------------
>
> Key: HBASE-15611
> URL: https://issues.apache.org/jira/browse/HBASE-15611
> Project: HBase
> Issue Type: Improvement
> Components: documentation, shell
> Reporter: Sean Busbey
> Labels: beginner
> Fix For: 2.0.0
>
>
> It would be nice if our shell documentation included some additional examples of operational tasks one can perform.
> things to include to come in comments. when we have a patch to submit we can update the jira summary to better reflect what scope we end up with.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)