3601314 / hbase-python Goto Github PK
View Code? Open in Web Editor NEWhbase-python is a pure python package used to access HBase.
hbase-python is a pure python package used to access HBase.
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.
as title,
ZK path cannot be customized.
my cluster hbase has a customed path.
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
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.
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
hbase-python/hbase/client/region.py
Line 247 in 4230091
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 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
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
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.
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?
Is it possible to add filters like SingleColumnValueFilter in scan() method ? If so,how to specify that parameter
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.