FAQ
Hi All,

My python script will access hbase using thrift.

I want to install this outside and inside hadoop/hbase cluster.

Can you let me know the install steps please?

Thanks

--

Search Discussions

  • Damien Hardy at Oct 5, 2012 at 3:17 pm
    Hello,

    If you have python-pip (alternative Python package installer) just install
    it with :

    pip install hbase_thrift

    Then use it like any other package
    Something like :


    from thrift.transport.TSocket import TSocket
    from thrift.transport.TTransport import TBufferedTransport
    from thrift.protocol import TBinaryProtocol
    from hbase import Hbase
    from hbase.ttypes import Mutation

    transport = TBufferedTransport(TSocket(host='127.0.0.1', port=9090)
    transport.open()
    protocol = TBinaryProtocol.TBinaryProtocol(transport)
    c = Hbase.Client(protocol)

    r = c.get('mytable', 'mykey', 'mycolfam:myqualifier')

    try:
    return r[0].value
    except IndexError:
    return None



    Cheers,

    --
    Damien


    Le vendredi 5 octobre 2012 04:42:36 UTC+2, Mike a écrit :
    Hi All,

    My python script will access hbase using thrift.

    I want to install this outside and inside hadoop/hbase cluster.

    Can you let me know the install steps please?

    Thanks
    --
  • Himanshu Vashishtha at Oct 5, 2012 at 4:41 pm
    You can also look at the example class, src/examples/thrift/DemoClient.py
    in the hbase src directory. It mentions steps on how to access HBase from a
    python client.

    Himanshu
    On Fri, Oct 5, 2012 at 8:17 AM, Damien Hardy wrote:

    Hello,

    If you have python-pip (alternative Python package installer) just install
    it with :

    pip install hbase_thrift

    Then use it like any other package
    Something like :


    from thrift.transport.TSocket import TSocket
    from thrift.transport.TTransport import TBufferedTransport
    from thrift.protocol import TBinaryProtocol
    from hbase import Hbase
    from hbase.ttypes import Mutation

    transport = TBufferedTransport(TSocket(host='127.0.0.1', port=9090)
    transport.open()
    protocol = TBinaryProtocol.TBinaryProtocol(transport)
    c = Hbase.Client(protocol)

    r = c.get('mytable', 'mykey', 'mycolfam:myqualifier')

    try:
    return r[0].value
    except IndexError:
    return None



    Cheers,

    --
    Damien


    Le vendredi 5 octobre 2012 04:42:36 UTC+2, Mike a écrit :
    Hi All,

    My python script will access hbase using thrift.

    I want to install this outside and inside hadoop/hbase cluster.

    Can you let me know the install steps please?

    Thanks
    --


    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcdh-user @
categorieshadoop
postedOct 5, '12 at 2:42a
activeOct 5, '12 at 4:41p
posts3
users3
websitecloudera.com
irc#hadoop

People

Translate

site design / logo © 2022 Grokbase