Cloudera Labs
Provide feedback on Cloudera Labs
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Phoenix database adapter for Python not working

Highlighted

Phoenix database adapter for Python not working

Contributor

Dear all.

 

I'm tring to select some data from phoenix by python 2.6.6

 

The source code is very simple.

 

import phoenixdb
database_url = 'http://xx.xx.xx.xx:8765/'
conn = phoenixdb.connect(database_url, autocommit=True)
cursor = conn.cursor()
cursor.execute("CREATE TABLE users (id INTEGER PRIMARY KEY, username VARCHAR)")
cursor.execute("UPSERT INTO users VALUES (?, ?)", (1, 'admin'))
cursor.execute("SELECT * FROM users")
print cursor.fetchall()

 

 

When executes it return errors below

 

python test.py       
Traceback (most recent call last):
  File "test.py", line 4, in <module>
    conn = phoenixdb.connect(database_url, autocommit=True)
  File "/usr/lib/python2.6/site-packages/phoenixdb/__init__.py", line 64, in connect
    return Connection(client, **kwargs)
  File "/usr/lib/python2.6/site-packages/phoenixdb/connection.py", line 47, in __init__
    self.open()
  File "/usr/lib/python2.6/site-packages/phoenixdb/connection.py", line 64, in open
    self._client.open_connection(self._id, info=self._connection_args)
  File "/usr/lib/python2.6/site-packages/phoenixdb/avatica.py", line 329, in open_connection
    response_data = self._apply(request)
  File "/usr/lib/python2.6/site-packages/phoenixdb/avatica.py", line 202, in _apply
    message.name = 'org.apache.calcite.avatica.proto.Requests${}'.format(request_name)
ValueError: zero length field name in format
Exception ValueError: 'zero length field name in format' in <bound method Connection.__del__ of <phoenixdb.connection.Connection object at 0x213bf10>> ignored

 

It seems to not good combination of python, phoenixdb, phoenix version.

 

Now I'm testing with this.

* CLABS_PHOENIX 4.7.0-1.clabs_phoenix1.3.0.p0.000
* Python 2.6.6
* phoenixdb (0.6)

 

Thanks.