Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable thriftpy's auto decoding? #122

Closed
cherrot opened this issue Apr 29, 2016 · 2 comments
Closed

How to disable thriftpy's auto decoding? #122

cherrot opened this issue Apr 29, 2016 · 2 comments

Comments

@cherrot
Copy link

cherrot commented Apr 29, 2016

Recently I found that thriftpy would decode hbase keys and values automatically. For example:

conn = happybase.Connection('example.hbase.com')
table =  conn.table('some_table')
table.put('an_image', {'cf1:content': image_file.read()})
table.put('a_text', {'cf1:content': 'hello happybase!'})

print( type(table.row('an_image')[u'cf1:content']) ) # str
print( type(table.row('a_text')[u'cf1:content']) )  # unicode

Is there an elegant way to disable this feature? Currently I'm doing like this:

row = table.row('some_key')
content = row['cf1:content']
if isinstance(content, unicode):
    content = content.encode('utf-8')
@wbolster
Copy link
Member

yep, known problem with current master. the latest released version does not use thriftpy so it does not have this problem.

my request to fix this Thriftpy/thriftpy#190 was addressed, but only partially, so i filed Thriftpy/thriftpy#193 and fixed it with Thriftpy/thriftpy#194.

however, since upstream has not rolled a new release with this fix yet (request for that is Thriftpy/thriftpy#197), this issue remains for now. i've filed #118 to track this.

:)

@wbolster
Copy link
Member

closing this as a duplicate of #118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants