Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added delete.

  • Loading branch information...
commit 95d8eda8fc0a6a29c3c4b2dc366e6feb8d843e44 1 parent c163d71
@hammer hammer authored
View
7 examples/pyhbase-cli
@@ -24,6 +24,8 @@ if __name__=="__main__":
put table row family1:qualifier1 value1 [family2:qualifier2 value2 ...]
scan table number_of_rows
+
+ delete table row [family1[:qualifier1] [family2[:qualifier2] ...]]
""" % sys.argv[0]
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
@@ -96,6 +98,11 @@ if __name__=="__main__":
usage()
sys.exit(1)
print connection.scan(*args)
+ elif cmd == 'delete':
+ if len(args) < 2:
+ usage()
+ sys.exit(1)
+ print connection.delete(*args)
else:
usage()
sys.exit(1)
View
9 pyhbase/connection.py
@@ -126,6 +126,15 @@ def put(self, table, row, *column_values):
# Delete
#
+ @retry_wrapper
+ def delete(self, table, row, *columns):
+ delete = {"row": row}
+ columns = [len(column) > 1 and {"family": column[0], "qualifier": column[1]} or {"family": column[0]}
+ for column in map(lambda s: s.split(":"), columns)]
+ if columns: delete["columns"] = columns
+ params = {"table": table, "delete": delete}
+ return self.requestor.request("delete", params)
+
#
# Scan
#
View
24 pyhbase/schema/hbase.avpr
@@ -190,6 +190,19 @@
"type" : [ "int", "null" ]
} ]
}, {
+ "type" : "record",
+ "name" : "ADelete",
+ "fields" : [ {
+ "name" : "row",
+ "type" : "bytes"
+ }, {
+ "name" : "columns",
+ "type" : [ {
+ "type" : "array",
+ "items" : "AColumn"
+ }, "null" ]
+ } ]
+ }, {
"type" : "error",
"name" : "AIOError",
"fields" : [ {
@@ -332,6 +345,17 @@
"items" : "AResult"
},
"errors" : [ "AIOError", "AIllegalArgument" ]
+ },
+ "delete" : {
+ "request" : [ {
+ "name" : "table",
+ "type" : "bytes"
+ }, {
+ "name" : "delete",
+ "type" : "ADelete"
+ } ],
+ "response" : "null",
+ "errors" : [ "AIOError" ]
}
}
}
View
2  setup.py
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
setup(name="PyHBase",
- version='0.0.5',
+ version='0.0.6',
description="High-level Python interface to HBase",
url="http://github.com/hammer/pyhbase/",
packages=['pyhbase'],
Please sign in to comment.
Something went wrong with that request. Please try again.