Search code examples
pysparkhbasehappybase

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


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 `('


Solution

  • 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.