Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updated to new genavro-ed interface.

  • Loading branch information...
commit eef8e3dc2a0fc6e6def4bf3ca28d35d5b108883f 1 parent 1b1140c
@hammer hammer authored
View
2  README.md
@@ -1,4 +1,4 @@
-A Python client for the HBase Avro interface.
+A Python client for the HBase Avro interface, currenlty under development at [hbase-trunk-with-avro](http://github.com/hammer/hbase-trunk-with-avro).
Borrows from the [Mozilla client](http://code.google.com/p/socorro/source/browse/trunk/socorro/hbase/hbaseClient.py).
View
10 examples/pyhbase-cli
@@ -11,12 +11,12 @@ if __name__=="__main__":
Commands:
show_tables
- is_table_enabled table_name
+ is_table_enabled table
- enable_table table_name
- disable_table table_name
+ enable_table table
+ disable_table table
- get table_name row family qualifier
+ get table row
""" % sys.argv[0]
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
@@ -60,7 +60,7 @@ if __name__=="__main__":
sys.exit(1)
print connection.disable_table(*args)
elif cmd == 'get':
- if len(args) != 4:
+ if len(args) != 2:
usage()
sys.exit(1)
print connection.get(*args)
View
16 pyhbase/connection.py
@@ -57,29 +57,29 @@ def show_tables(self):
return self.requestor.request("getTableNames", {})
@retry_wrapper
- def is_table_enabled(self, table_name):
+ def is_table_enabled(self, table):
"""Determine if a table is enabled."""
- return self.requestor.request("isTableEnabled", {"tableName": table_name})
+ return self.requestor.request("isTableEnabled", {"table": table})
#
# Administrative Operations
#
@retry_wrapper
- def enable_table(self, table_name):
- return self.requestor.request("enableTable", {"tableName": table_name})
+ def enable_table(self, table):
+ return self.requestor.request("enableTable", {"table": table})
@retry_wrapper
- def disable_table(self, table_name):
- return self.requestor.request("disableTable", {"tableName": table_name})
+ def disable_table(self, table):
+ return self.requestor.request("disableTable", {"table": table})
#
# Get
#
@retry_wrapper
- def get(self, table_name, row, family, qualifier):
- params = {"tableName": table_name, "row": row, "family": family, "qualifier": qualifier}
+ def get(self, table, row):
+ params = {"table": table, "get": {"row": row}}
return self.requestor.request("get", params)
#
View
177 pyhbase/schema/hbase.avpr
@@ -1,49 +1,128 @@
-{"namespace": "org.apache.hadoop.hbase.avro.generated",
- "protocol": "HBase",
-
- "types": [
- {"name": "TCell", "type": "record",
- "fields": [
- {"name": "value", "type": "bytes"},
- {"name": "timestamp", "type": "long"}
- ]
- },
- {"name": "IOError", "type": "error",
- "fields": [
- {"name": "message", "type": "string"}
- ]
- }
- ],
-
- "messages": {
- "enableTable": {
- "request": [{"name": "tableName", "type": "bytes"}],
- "response": "null",
- "errors": ["IOError"]
- },
- "disableTable": {
- "request": [{"name": "tableName", "type": "bytes"}],
- "response": "null",
- "errors": ["IOError"]
- },
- "isTableEnabled": {
- "request": [{"name": "tableName", "type": "bytes"}],
- "response": "boolean",
- "errors": ["IOError"]
- },
- "getTableNames": {
- "request": [],
- "response": {"type": "array", "items": "bytes"},
- "errors": ["IOError"]
- },
- "get": {
- "request": [{"name": "tableName", "type": "bytes"},
- {"name": "row", "type": "bytes"},
- {"name": "family", "type": "bytes"},
- {"name": "qualifier", "type": "bytes"}
- ],
- "response": {"type": "array", "items": "TCell"},
- "errors": ["IOError"]
- }
- }
-}
+{
+ "protocol" : "HBase",
+ "namespace" : "org.apache.hadoop.hbase.avro.generated",
+ "types" : [ {
+ "type" : "record",
+ "name" : "AColumn",
+ "fields" : [ {
+ "name" : "family",
+ "type" : "bytes"
+ }, {
+ "name" : "qualifier",
+ "type" : [ "bytes", "null" ]
+ } ]
+ }, {
+ "type" : "record",
+ "name" : "AResultEntry",
+ "fields" : [ {
+ "name" : "family",
+ "type" : "bytes"
+ }, {
+ "name" : "qualifier",
+ "type" : "bytes"
+ }, {
+ "name" : "value",
+ "type" : "bytes"
+ }, {
+ "name" : "timestamp",
+ "type" : "long"
+ } ]
+ }, {
+ "type" : "record",
+ "name" : "AResult",
+ "fields" : [ {
+ "name" : "row",
+ "type" : "bytes"
+ }, {
+ "name" : "entries",
+ "type" : [ {
+ "type" : "array",
+ "items" : "AResultEntry"
+ }, "null" ]
+ } ]
+ }, {
+ "type" : "record",
+ "name" : "ATimeRange",
+ "fields" : [ {
+ "name" : "minStamp",
+ "type" : "long"
+ }, {
+ "name" : "maxStamp",
+ "type" : "long"
+ } ]
+ }, {
+ "type" : "record",
+ "name" : "AGet",
+ "fields" : [ {
+ "name" : "row",
+ "type" : "bytes"
+ }, {
+ "name" : "columns",
+ "type" : [ {
+ "type" : "array",
+ "items" : "AColumn"
+ }, "null" ]
+ }, {
+ "name" : "timestamp",
+ "type" : [ "long", "null" ]
+ }, {
+ "name" : "timerange",
+ "type" : [ "ATimeRange", "null" ]
+ }, {
+ "name" : "maxVersions",
+ "type" : [ "int", "null" ]
+ } ]
+ }, {
+ "type" : "error",
+ "name" : "AIOError",
+ "fields" : [ {
+ "name" : "message",
+ "type" : "string"
+ } ]
+ } ],
+ "messages" : {
+ "enableTable" : {
+ "request" : [ {
+ "name" : "table",
+ "type" : "bytes"
+ } ],
+ "response" : "null",
+ "errors" : [ "AIOError" ]
+ },
+ "disableTable" : {
+ "request" : [ {
+ "name" : "table",
+ "type" : "bytes"
+ } ],
+ "response" : "null",
+ "errors" : [ "AIOError" ]
+ },
+ "isTableEnabled" : {
+ "request" : [ {
+ "name" : "table",
+ "type" : "bytes"
+ } ],
+ "response" : "boolean",
+ "errors" : [ "AIOError" ]
+ },
+ "getTableNames" : {
+ "request" : [ ],
+ "response" : {
+ "type" : "array",
+ "items" : "bytes"
+ },
+ "errors" : [ "AIOError" ]
+ },
+ "get" : {
+ "request" : [ {
+ "name" : "table",
+ "type" : "bytes"
+ }, {
+ "name" : "get",
+ "type" : "AGet"
+ } ],
+ "response" : "AResult",
+ "errors" : [ "AIOError" ]
+ }
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.