标签: graph-notebook

我可以在 Jupyter Notebook 中使用 Gremlin Python 客户端并避免事件循环错误吗?

我知道图形笔记本项目允许使用魔法命令提交 Gremlin 查询。但是,有时我需要在常规 Jupyter 笔记本单元中使用 Python 进行编码并使用代码连接到服务器。如果使用 Gremlin Python 3.5.2 客户端,我尝试执行以下操作:

server = '<your server endpoint goes here>'
port = 8182

endpoint = f'wss://{server}:{port}/gremlin'

connection = DriverRemoteConnection(endpoint,'g')

g = traversal().withRemote(connection)
Run Code Online (Sandbox Code Playgroud)

由于 Jupyter 事件循环已在运行,因此会引发错误。

有没有解决的办法?

gremlin tinkerpop amazon-neptune gremlinpython graph-notebook

2
推荐指数
1
解决办法
818
查看次数

Gremlin Python 无法运行事件循环

我正在运行 Gremlin Python。首先,我按照此处的说明在本地计算机中进行了安装,然后我在此处运行了该网站的代码,但此时出现以下错误:

    heading('SubgraphStrategy - just Texas airports')
    strategy = SubgraphStrategy(vertices=__.has("region","US-TX"), edges=__.hasLabel('route'))
    g2 = g.withStrategies(strategy)
    verts = g2.V().count().next()

RuntimeError: Cannot run the event loop while another loop is running
Run Code Online (Sandbox Code Playgroud)

我使用以下代码验证了与 Gremlin Server 的图形数据库的连接

%%graph_notebook_config
{
  "host": "localhost",
  "port": 8182,
  "ssl": false,
  "gremlin": {
    "traversal_source": "g"
  }
}
Run Code Online (Sandbox Code Playgroud)

我找到了一些“RuntimeError:在另一个循环运行时无法运行事件循环”的解决方案,例如 Nest_async 但后来我收到了不同的错误。

谢谢

python graph gremlin graph-notebook

2
推荐指数
1
解决办法
1622
查看次数