Skip to content

Commit

Permalink
Adding tableExists
Browse files Browse the repository at this point in the history
  • Loading branch information
hammer committed May 28, 2010
1 parent 95d8eda commit 84337cc
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
13 changes: 8 additions & 5 deletions examples/pyhbase-cli
Expand Up @@ -14,18 +14,16 @@ if __name__=="__main__":
describe_table table
describe_family table family
is_table_enabled table
table_exists table
create_table table [family1 [family2 ...]]
enable_table table
disable_table table
get table row [family1[:qualifier1] [family2[:qualifier2] ...]]
put table row family1:qualifier1 value1 [family2:qualifier2 value2 ...]
scan table number_of_rows
get table row [family1[:qualifier1] [family2[:qualifier2] ...]]
delete table row [family1[:qualifier1] [family2[:qualifier2] ...]]
scan table number_of_rows
""" % sys.argv[0]

if len(sys.argv) <= 1 or sys.argv[1] == '--help':
Expand Down Expand Up @@ -68,6 +66,11 @@ if __name__=="__main__":
usage()
sys.exit(1)
print connection.is_table_enabled(*args)
elif cmd == 'table_exists':
if len(args) != 1:
usage()
sys.exit(1)
print connection.table_exists(*args)
elif cmd == 'create_table':
if len(args) < 1:
usage()
Expand Down
5 changes: 5 additions & 0 deletions pyhbase/connection.py
Expand Up @@ -73,6 +73,11 @@ def is_table_enabled(self, table):
"""Determine if a table is enabled."""
return self.requestor.request("isTableEnabled", {"table": table})

@retry_wrapper
def table_exists(self, table):
"""Determine if a table exists."""
return self.requestor.request("tableExists", {"table": table})

#
# Administrative Operations
#
Expand Down
8 changes: 8 additions & 0 deletions pyhbase/schema/hbase.avpr
Expand Up @@ -264,6 +264,14 @@
"response" : "boolean",
"errors" : [ "AIOError" ]
},
"tableExists" : {
"request" : [ {
"name" : "table",
"type" : "bytes"
} ],
"response" : "boolean",
"errors" : [ "AIOError" ]
},
"listTables" : {
"request" : [ ],
"response" : {
Expand Down
2 changes: 1 addition & 1 deletion setup.py
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages

setup(name="PyHBase",
version='0.0.6',
version='0.0.7',
description="High-level Python interface to HBase",
url="http://github.com/hammer/pyhbase/",
packages=['pyhbase'],
Expand Down

0 comments on commit 84337cc

Please sign in to comment.