in python/thrift/flask_thrift.py [0:0]
def get(table, key, column, type_):
"""
Handle our incoming REST requests to interface with Bigtable.
For POST or DELETE, we dispatch to other private methods.
For GET, we handle right in this method.
:param table: The table name we would like to interface with
:param key: The row key of the row we are getting or mutating
:param column: The fully qualified column name, including the column family
prefix in the standard cf:column_name format
:param type_: 'str' to store the byte string directly, or 'int' to
parse the string as an integer and store it as an integer
:return: A string indicating the result of the call.
"""
if request.method == 'POST':
_put(table, key, column, request.get_data(), type_)
return "Updated."
if request.method == 'DELETE':
_delete_column(table, key, column)
return "Deleted."
with ThriftClient() as client:
value = client.get_row(table, key)
if not value:
return "Not found"
value = value[0].columns[column].value
if type_ == 'int':
value = _decode_int(value)
return str(value)