Cloudera Labs
Provide feedback on Cloudera Labs

Phoenix database adapter for Python not working


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


Traceback (most recent call last):
  File "", line 4, in <module>
    conn = phoenixdb.connect(database_url, autocommit=True)
  File "/usr/lib/python2.6/site-packages/phoenixdb/", line 64, in connect
    return Connection(client, **kwargs)
  File "/usr/lib/python2.6/site-packages/phoenixdb/", line 47, in __init__
  File "/usr/lib/python2.6/site-packages/phoenixdb/", line 64, in open
    self._client.open_connection(self._id, info=self._connection_args)
  File "/usr/lib/python2.6/site-packages/phoenixdb/", line 329, in open_connection
    response_data = self._apply(request)
  File "/usr/lib/python2.6/site-packages/phoenixdb/", line 202, in _apply = '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)