Giter Club home page Giter Club logo

hbase-python's People

Contributors

ckoops avatar valericus avatar xoriieinpottn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hbase-python's Issues

PyPI release 0.5 is unusable

The release doesn't include the changes to the setup.py requirements that were added here. This means that after installing, if you try to import hbase you get an error about not having protobuf installed.

could not access the table if the table had been granted ACL

currently I used this to get the table which have been granted the ACL from hbase cluster, it raise the exception : hbase.exceptions.RequestError: org.apache.hadoop.hbase.security.AccessDeniedException.
It seems that now this package miss some function to set the env property : HADOOP_USER_NAME

File "<ipython-input-1-5a24ebc28a89>", line 5, in <module> from hbase import Hbase File "C:\Users\anarayan\Anaconda3\lib\site-packages\hbase\Hbase.py", line 2066 except IOError, io: ^ SyntaxError: invalid syntax

While importing HBase from hbase, i am getting this error:

File "C:\Users\anarayan\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3437, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)

File "", line 5, in
from hbase import Hbase

File "C:\Users\anarayan\Anaconda3\lib\site-packages\hbase\Hbase.py", line 2066
except IOError, io:
^
SyntaxError: invalid syntax

This is causing hindrance in connecting to Hbase from python. Please provide solution.

hbase.exceptions.RequestError: Failed to get region for default namespace

I got hbase.exceptions.RequestError: Failed to get region exception when tried to do get operation from the table located in the default namespace.

Here is my code:

    with hbase.ConnectionPool(zk).connect() as conn:
        table = conn['default']['table_name']
        row = table.get('row1')
        print(row)
    exit()

Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1664, in
main()
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1658, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1068, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/nazarii/PycharmProjects/smartness/scripts/hbase/hbase_test.py", line 25, in
main()
File "/Users/nazarii/PycharmProjects/smartness/scripts/hbase/hbase_test.py", line 17, in main
row = table.get('ts/github/82270896/1487289600000')
File "/Users/nazarii/PycharmProjects/untitled/venv/lib/python3.7/site-packages/hbase/table.py", line 117, in get
return self._client.get(self.full_name, key, columns, filter)
File "/Users/nazarii/PycharmProjects/untitled/venv/lib/python3.7/site-packages/hbase/client/client.py", line 753, in get
region = self._region_manager.get_region(table, key)
File "/Users/nazarii/PycharmProjects/untitled/venv/lib/python3.7/site-packages/hbase/client/region.py", line 202, in get_region
'Failed to get region.'
hbase.exceptions.RequestError: Failed to get region.

I did further investigation and find the reason.

When this function is called

def _region_lookup(self, meta_key):

We have meta_key = 'default:table_name,row1,:'
Change that to the meta_key = 'table_name,row1,:' fixes the issue.

So HBase API does expect only table_name for the default namespace and default:table_name is not valid.

I would suggest fixing that. I can do that myself and open PR if you agree to change the way the meta_key is formed.

hbase.exceptions.RequestError: org.apache.hadoop.hbase.exceptions.UnknownProtocolException

hbase 2.1.0
python 3.6

my code

import hbase 
zk = '172.25.33.230:2181,172.25.33.231:2181,172.25.33.232:2181'


def test():
    with hbase.ConnectionPool( zk ).connect() as conn:
        table = conn['hbase']['TraceV2']

        table.count()
    exit()

if __name__ == '__main__':
    test()

Exception as below :

Traceback (most recent call last):
  File "D:/wehotel_product/untitled/test-hbase/main.py", line 18, in <module>
    test()
  File "D:/wehotel_product/untitled/test-hbase/main.py", line 13, in test
    table.count()
  File "D:\wehotel_product\untitled\venv\lib\site-packages\hbase\table.py", line 204, in count
    batch_size=500
  File "D:\wehotel_product\untitled\venv\lib\site-packages\hbase\table.py", line 477, in __next__
    batch = self._client.iter_scanner(self.scanner)
  File "D:\wehotel_product\untitled\venv\lib\site-packages\hbase\client\client.py", line 1259, in iter_scanner
    region = self._region_manager.get_region(scanner.__table__, start_key)
  File "D:\wehotel_product\untitled\venv\lib\site-packages\hbase\client\region.py", line 199, in get_region
    region = self._region_lookup(meta_key)
  File "D:\wehotel_product\untitled\venv\lib\site-packages\hbase\client\region.py", line 258, in _region_lookup
    resp = self._meta_service.request(req)
  File "D:\wehotel_product\untitled\venv\lib\site-packages\hbase\services\services.py", line 61, in request
    return self._request.call(pb_req)
  File "D:\wehotel_product\untitled\venv\lib\site-packages\hbase\services\request.py", line 192, in call
    raise exceptions.RequestError(error)
hbase.exceptions.RequestError: org.apache.hadoop.hbase.exceptions.UnknownProtocolException

image

when I check the response , find header error info

call_id: 0
exception {
  exception_class_name: "org.apache.hadoop.hbase.exceptions.UnknownProtocolException"
  stack_trace: "org.apache.hadoop.hbase.exceptions.UnknownProtocolException: Is this a pre-hbase-1.0.0 or asynchbase client? Client is invoking getClosestRowBefore removed in hbase-2.0.0 replaced by reverse Scan.\n\tat org.apache.hadoop.hbase.regionserver.RSRpcServices.get(RSRpcServices.java:2445)\n\tat org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:41998)\n\tat org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:409)\n\tat org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:130)\n\tat org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:324)\n\tat org.apache.hadoop.hbase.ipc.RpcExecutor$Handler.run(RpcExecutor.java:304)\n"
  do_not_retry: true
}

there any problem ? please help me

Support for byte keys

It doesn't look like this repo is actively maintained.. but I'm filing this anyway. Who knows, maybe someone will pick it up in the future.

The HBase java api lets you write to rows with binary data as keys. Right now if you try to call get() with a bytes key you'll get an error.

Support fetch regions for table

Thanks a lot for this library which helps me a lot. However, I wish to fetch regions for a certain table. I think that fetching region info is very related to my need, and I notice that a pb request is sent to meta service to fetch region info. Could you give me a hint how to interact with meta service by a dev doc or sth else?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.