Error while Happybase connection with hbase, how I define my host

205 Views Asked by At

I want to connect Pyspark with Hbase by Happybase. But I get this error at the beginnig:

(pyenv) hduser@master:~$ python -c 'import happybase'
(pyenv) hduser@master:~$ python -c connection = happybase.Connection("somehost") bash: syntax error near unexpected token `('

1

There are 1 best solutions below

0
On BEST ANSWER

First there is a syntax error in connection command. Secondly if you want to use the happybase library in subsequent steps, you have to run the entire script into single command from the bash in following way so that the session will be maintained.

 python -c "import happybase;connection = happybase.Connection('localhost')"

Another option is create a python .py file and run that from the bash.