Support Questions

Find answers, ask questions, and share your expertise

Phoenixdb FetchAll not working

avatar
New Contributor

The queries like upsert are working fine and data is getting inserted into tables but when I execute a select query and print result, it shows empty.

The output which I am getting for this is [ ].

I have checked with sqlline.py and have seen that the table has 2 rows.

import phoenixdb
database_url = 'http://localhost:8765/?v=1.6'
conn = phoenixdb.connect(database_url, autocommit=True)
cursor = conn.cursor()
cursor.execute("upsert into users values(2,'user')")
cursor.execute("select * from users")
print cursor.fetchall()
1 ACCEPTED SOLUTION

avatar
Master Guru

I think the issue is using the same cursor or it's because of you using the wrong version of Phoenix/Phoenix connection.

Remember you also need to be using an older version as the newest version of Phoenix uses Google Protocol Buffers for data retrieval and PhoenixDB only does the older jSON.

See: https://bitbucket.org/lalinsky/python-phoenixdb

Is your server running Phoenix 4.7, then it is v=1.6, but that is Protocol Buffers. Python does not support this. You can restart your phoenix query server with the phoenix.queryserver.serialization parameter set to JSON.

Hopefully Python-PhoenixDB will be updated to use the current protocol.

View solution in original post

1 REPLY 1

avatar
Master Guru

I think the issue is using the same cursor or it's because of you using the wrong version of Phoenix/Phoenix connection.

Remember you also need to be using an older version as the newest version of Phoenix uses Google Protocol Buffers for data retrieval and PhoenixDB only does the older jSON.

See: https://bitbucket.org/lalinsky/python-phoenixdb

Is your server running Phoenix 4.7, then it is v=1.6, but that is Protocol Buffers. Python does not support this. You can restart your phoenix query server with the phoenix.queryserver.serialization parameter set to JSON.

Hopefully Python-PhoenixDB will be updated to use the current protocol.