#coding:utf8
import time
import json
from nebula2.gclient.net import ConnectionPool
from nebula2.Config import Config
from nebula2.common import *
if __name__=='__main__':
client =None
try:
config = Config()
config.max_connection_pool_size=2
connection_pool = ConnectionPool()
connection_pool.init([('192.168.52.91',9669)],config)
client = connection_pool.get_session('root','123')
assert client is not None
resp_json = client.execute_json("yield 1")
json_obj = json.loads(resp_json)
print(json.dumps(json_obj,indent=2,sort_keys=True))
except Exception as x:
import traceback
print(traceback.format_exc())
if client is not None:
client.release()
exit(1)
[2021-10-28 12:24:12,222] WARNING [ConnectionPool.py:203]:Connect 192.168.52.91:9669 failed: Method name verifyClientVersion not found
Traceback (most recent call last):
File "F:/知识图谱/nebula_conn/nebula_conn.py", line 15, in <module>
connection_pool.init([('192.168.52.91',9669)],config)
File "E:\Anaconda3\lib\site-packages\nebula2_python-2.5.0-py3.6.egg\nebula2\gclient\net\ConnectionPool.py", line 78, in init
self._get_services_status()))
RuntimeError: The services status exception: [services: ('192.168.52.91', 9669), status: BAD]
看报错应该是服务器版本里有 检查版本,但是 python-client 之中没有这个函数,请问您的 nebula-python 版本和 nebula graph 版本是?
Nebula2-Python Version | NebulaGraph Version |
---|---|
2.0.0b1 | 2.0.0beta |
2.0.0rc1 | 2.0.0-rc1 |
2.0.0 | 2.0.0/2.0.1 |
2.5.0 | 2.5.0 |
nebula-python版本号是2.5.0
nebula graph是3.0.0
Nebula Graph 可以 show hosts graph 一下看看,3.0.0 是 studio 的版本?肯定不是 nebula graph 的版本
graph是2.5.0,我现在把nebula-python版本降到2.0.0就可以用了,感谢
1 个赞
应该是客户端 2.6.0 python client 才做了 execute_json 的支持(晚于 core)如果需要用到 execute_json,可以把 core/client 都升级到 2.6.x,在那之前只能先用 execute ,返回的是 result 对象,可以参考例子去解析,或者在交互的 python console 里试着分析返回的结果哈~~
2 个赞
此话题已在最后回复的 30 天后被自动关闭。不再允许新回复。