Permalink
Browse files

Added deleteTable and flush.

  • Loading branch information...
1 parent baf756a commit b8ec6ba5e6a8fb67b59a70c6d7c9243a858bb860 @hammer hammer committed May 28, 2010
Showing with 40 additions and 1 deletion.
  1. +12 −0 examples/pyhbase-cli
  2. +11 −0 pyhbase/connection.py
  3. +16 −0 pyhbase/schema/hbase.avpr
  4. +1 −1 setup.py
View
12 examples/pyhbase-cli
@@ -20,6 +20,8 @@ if __name__=="__main__":
create_table table [family1 [family2 ...]]
enable_table table
disable_table table
+ drop table
+ flush table
put table row family1:qualifier1 value1 [family2:qualifier2 value2 ...]
get table row [family1[:qualifier1] [family2[:qualifier2] ...]]
@@ -82,6 +84,11 @@ if __name__=="__main__":
usage()
sys.exit(1)
print connection.create_table(*args)
+ elif cmd == 'drop':
+ if len(args) != 1:
+ usage()
+ sys.exit(1)
+ print connection.drop(*args)
elif cmd == 'enable_table':
if len(args) != 1:
usage()
@@ -92,6 +99,11 @@ if __name__=="__main__":
usage()
sys.exit(1)
print connection.disable_table(*args)
+ elif cmd == 'flush':
+ if len(args) != 1:
+ usage()
+ sys.exit(1)
+ print connection.flush(*args)
elif cmd == 'get':
if len(args) < 2:
usage()
View
11 pyhbase/connection.py
@@ -94,6 +94,17 @@ def create_table(self, table, *families):
if families: table_descriptor["families"] = families
return self.requestor.request("createTable", {"table": table_descriptor})
+ # TODO(hammer): Automatically major_compact .META. too?
+ # NB: flush is an asynchronous operation, so don't retry
+ def drop(self, table):
+ self.disable_table(table)
+ self.requestor.request("deleteTable", {"table": table})
+ return self.flush(".META.")
+
+ # NB: flush is an asynchronous operation, so don't retry
+ def flush(self, table):
+ self.requestor.request("flush", {"table": table})
+
@retry_wrapper
def enable_table(self, table):
return self.requestor.request("enableTable", {"table": table})
View
16 pyhbase/schema/hbase.avpr
@@ -240,6 +240,14 @@
"response" : "null",
"errors" : [ "AIOError", "AIllegalArgument", "ATableExists", "AMasterNotRunning" ]
},
+ "deleteTable" : {
+ "request" : [ {
+ "name" : "table",
+ "type" : "bytes"
+ } ],
+ "response" : "null",
+ "errors" : [ "AIOError" ]
+ },
"enableTable" : {
"request" : [ {
"name" : "table",
@@ -256,6 +264,14 @@
"response" : "null",
"errors" : [ "AIOError" ]
},
+ "flush" : {
+ "request" : [ {
+ "name" : "table",
+ "type" : "bytes"
+ } ],
+ "response" : "null",
+ "errors" : [ "AIOError" ]
+ },
"isTableEnabled" : {
"request" : [ {
"name" : "table",
View
2 setup.py
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
setup(name="PyHBase",
- version='0.0.8',
+ version='0.0.9',
description="High-level Python interface to HBase",
url="http://github.com/hammer/pyhbase/",
packages=['pyhbase'],

0 comments on commit b8ec6ba

Please sign in to comment.