hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Purtell <apurt...@apache.org>
Subject Re: Spaces disappear in HBase?
Date Mon, 03 Oct 2011 23:50:50 GMT
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 <bwsithspawn00@yahoo.com>
>To: "user@hbase.apache.org" <user@hbase.apache.org>
>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
>
>
>
>
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message