Permalink
Browse files

Refactored list_tables and added describe_table and describe_family.

  • Loading branch information...
1 parent 9e9b4e3 commit b5cee6254219f06f1d0345e0d53280b0161f6189 @hammer hammer committed May 23, 2010
Showing with 41 additions and 0 deletions.
  1. +12 −0 examples/pyhbase-cli
  2. +10 −0 pyhbase/connection.py
  3. +19 −0 pyhbase/schema/hbase.avpr
View
12 examples/pyhbase-cli
@@ -11,6 +11,8 @@ if __name__=="__main__":
Commands:
list_tables
+ describe_table table
+ describe_family table family
is_table_enabled table
create_table table [family1 [family2 ...]]
@@ -47,6 +49,16 @@ if __name__=="__main__":
usage()
sys.exit(1)
print connection.list_tables(*args)
+ elif cmd == 'describe_table':
+ if len(args) != 1:
+ usage()
+ sys.exit(1)
+ print connection.describe_table(*args)
+ elif cmd == 'describe_family':
+ if len(args) != 2:
+ usage()
+ sys.exit(1)
+ print connection.describe_family(*args)
elif cmd == 'is_table_enabled':
if len(args) != 1:
usage()
View
10 pyhbase/connection.py
@@ -59,6 +59,16 @@ def list_tables(self):
return self.requestor.request("listTables", {})
@retry_wrapper
+ def describe_table(self, table):
+ """Grab table information."""
+ return self.requestor.request("describeTable", {"table": table})
+
+ @retry_wrapper
+ def describe_family(self, table, family):
+ """Grab family information."""
+ return self.requestor.request("describeFamily", {"table": table, "family": family})
+
+ @retry_wrapper
def is_table_enabled(self, table):
"""Determine if a table is enabled."""
return self.requestor.request("isTableEnabled", {"table": table})
View
19 pyhbase/schema/hbase.avpr
@@ -234,6 +234,25 @@
},
"errors" : [ "AIOError" ]
},
+ "describeTable" : {
+ "request" : [ {
+ "name" : "table",
+ "type" : "bytes"
+ } ],
+ "response" : "ATableDescriptor",
+ "errors" : [ "AIOError" ]
+ },
+ "describeFamily" : {
+ "request" : [ {
+ "name" : "table",
+ "type" : "bytes"
+ }, {
+ "name" : "family",
+ "type" : "bytes"
+ } ],
+ "response" : "AFamilyDescriptor",
+ "errors" : [ "AIOError" ]
+ },
"get" : {
"request" : [ {
"name" : "table",

0 comments on commit b5cee62

Please sign in to comment.