Keys and values need to be base64 encoded in all non-binary representations, 
XML and JSON currently.
 
Best regards,


   - Andy

Problems worthy of attack prove their worth by hitting back. - Piet Hein (via 
Tom White)


>________________________________
>From: Ben West <[email protected]>
>To: "[email protected]" <[email protected]>
>Sent: Sunday, October 2, 2011 1:15 PM
>Subject: Spaces disappear in HBase?
>
>Hey all,
>
>I'm running the standalone HBase server (0.90.4) and REST client (version 
>0.0.2). When I POST data and then GET it back, the data is changed; 
>particularly the spaces seem to be removed. Does anyone know what's going on?
>
>Here is a python script replicating my problem; I have a table named 'eipi' 
>with a column family 'eipi':
>
>#!/usr/bin/python
>
>import sys
>import urllib2
>import simplejson
>
>
>def getData(name, val):
>cell = { 'Row': 
>{'@key' : 'foo', 
>'Cell': [{'@column': 'eipi:%s' % name, 
>'$': val }] 
>}
>}
>return simplejson.dumps(cell)
>
>def sendData(key, colName, colVal):
>opener = urllib2.build_opener()
>url = 'http://localhost:8081/eipi/%s/eipi:%s' % (key, colName)
>print colVal
>req = urllib2.Request(url, 
>headers = { 'Content-Type': 'application/json' },
>data = getData(colName, colVal))
>f = opener.open(req)
>f.read()
>
>def printData(key):
>opener = urllib2.build_opener()
>url = 'http://localhost:8081/eipi/%s' % key
>req = urllib2.Request(url, 
>headers = { 'Accept': 'application/json' })
>f = opener.open(req)
>parsed = simplejson.load(f)
>print(parsed['Row'][0]['Cell'][0]['$'])
>
>sendData('test','eipi:test','some stuff')
>printData('test')
>
>
>result:
>> python getHBase.py 
>some stuff
>somestuf
>
>(The space was removed, as well as a trailing 'f'...)
>
>Thanks!
>-Ben
>
>
>
>

Reply via email to