Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Error occured when connecting to Phoenix with phoenixdb (Python)

Error occured when connecting to Phoenix with phoenixdb (Python)

New Contributor

I tried to connect to phoenix with phoenixdb, and the following is the code snippet where hdp-02 is the machine which queryserver is running at.

 

import phoenixdb 
import phoenixdb.cursor 

url = 'http://hdp-02:8765/'
conn = phoenixdb.connect(url, autocommit=True)

 

 

But then I got this error

OperationalError: ('Malformed connection url. :hdp-02:2181,hdp-03:2181,hdp-04:2181:2181:/hbase;', 102, '08001', None)

hdp-02, hdp-03, hdp-04 are the machines where zookeeper cluster is configured. I can't find similar problem such as the one I encountered online. Does anyone know how to solve it? Thanks.

 

Here is the complete error message:

---------------------------------------------------------------------------

OperationalError                          Traceback (most recent call last)
<ipython-input-15-9a412f3f8fc6> in <module>
      1 url = 'http://hdp-02:8765/'
      2 # url = 'jdbc:phoenix:hdp-02,hdp-03,hdp-04:2181'
----> 3 conn = phoenixdb.connect(url, autocommit=True)
      4
      5 # cursor = conn.cursor()D:\anaconda3\Lib\site-packages\phoenixdb\__init__.py in connect(url, max_retries, **kwargs)
     65     client = AvaticaClient(url, max_retries=max_retries)
     66     client.connect()
---> 67     return Connection(client, **kwargs)D:\anaconda3\Lib\site-packages\phoenixdb\connection.py in __init__(self, client, cursor_factory, **kwargs)
     54             else:
     55                 self._filtered_args[k] = kwargs[k]
---> 56         self.open()
     57         self.set_session(**self._filtered_args)
     58D:\anaconda3\Lib\site-packages\phoenixdb\connection.py in open(self)
     71         """Opens the connection."""
     72         self._id = str(uuid.uuid4())
---> 73         self._client.open_connection(self._id, info=self._connection_args)
     74
     75     def close(self):D:\anaconda3\Lib\site-packages\phoenixdb\avatica.py in open_connection(self, connection_id, info)
    327                 request.info[k] = v
    328
--> 329         response_data = self._apply(request)
    330         response = responses_pb2.OpenConnectionResponse()
    331         response.ParseFromString(response_data)D:\anaconda3\Lib\site-packages\phoenixdb\avatica.py in _apply(self, request_data, expected_response_type)
    214             else:
    215                 # assume the response is in protobuf format
--> 216                 parse_error_protobuf(response_body)
    217             raise errors.InterfaceError('RPC request returned invalid status code', response.status)
    218D:\anaconda3\Lib\site-packages\phoenixdb\avatica.py in parse_error_protobuf(text)
    125     err.ParseFromString(message.wrapped_message)
    126
--> 127     parse_and_raise_sql_error(err.error_message)
    128     raise_sql_error(err.error_code, err.sql_state, err.error_message)
    129     raise errors.InternalError(err.error_message)D:\anaconda3\Lib\site-packages\phoenixdb\avatica.py in parse_and_raise_sql_error(message)
    106     if match is not None and len(match):
    107         exception, code, sqlstate, message = match[0]
--> 108         raise_sql_error(int(code), sqlstate, message)
    109
    110D:\anaconda3\Lib\site-packages\phoenixdb\avatica.py in raise_sql_error(code, sqlstate, message)
     99     for prefix, error_class in SQLSTATE_ERROR_CLASSES:
    100         if sqlstate.startswith(prefix):
--> 101             raise error_class(message, code, sqlstate)
    102
    103

OperationalError: ('Malformed connection url. :hdp-02:2181,hdp-03:2181,hdp-04:2181:2181:/hbase;', 102, '08001', None)

 

Don't have an account?
Coming from Hortonworks? Activate your account here