hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben West <bwsithspaw...@yahoo.com>
Subject Spaces disappear in HBase?
Date Sun, 02 Oct 2011 20:15:39 GMT
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


Mime
View raw message