提问参考模版:
-
nebula 版本:3.6.0
-
部署方式:单机
-
安装方式:Docker
-
是否上生产环境:Y
-
硬件信息
- SSD
- WSL2 下的ubuntu
- 8核CPU,内存24G
-
问题的具体描述
使用相同的ngql,在python代码中结果返回为 ResultSet(None),但在 webstudio 中返回是有值的。这是为什么呀?
代码如下:
from nebula3.gclient.net import ConnectionPool
from nebula3.Config import Config
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
# define a config
config = Config()
config.max_connection_pool_size = 10
# init connection pool
connection_pool = ConnectionPool()
# if the given servers are ok, return true, else return false
ok = connection_pool.init([('172.19.0.1', 9669)], config)
if not ok:
raise ValueError("connection pool init failed")
session = connection_pool.get_session('root', 'nebula')
assert session is not None
session.execute('USE qixincha-v2')
result = session.execute("MATCH (n)-[:hold_share]->(v) WHERE id(v) == '7805cdb90538ec48fc9f5f45d1c8ac44' RETURN n;")
print(result)
session.release()
return 'SUCCESS'