python - 使用 pythongremlin 删除 AWS Neptune 上的所有边

标签 python gremlin amazon-neptune

我正在使用 gremlinpython 版本 3.3.2 和 AWS NEPTUNE。
我尝试删除所有边(也尝试过顶点),但每次都失败。
g.E().drop().iterate()
给我:

gremlin_python.driver.protocol.GremlinServerError: 597: Exception processing a script on request [RequestMessage{, requestId=ae49cbb7-e034-4e56-ac76-b62310f753c2, op='bytecode', processor='traversal', args={gremlin=[[], [V(), drop()]], aliases={g=g}}}].

有人已经成功删除了 AWS Neptune 中图表的所有顶点/边吗?

编辑: 删除特定 ID 有效:
g.E(id).drop().iterate()

编辑2:
这是使用 gremlin 控制台完成的回溯:

gremlin> g.E().count().next()

==>740839
gremlin> g.E().drop().iterate()
A timeout occurred within the script during evaluation of [RequestMessage{, requestId=24c3d14c-c8be-4ed9-a297-3fd2b38ace9a, op='eval', > processor='', args={gremlin=g.E().drop().iterate(), bindings={}, batchSize=64}}] - consider increasing the timeout
Type ':help' or ':h' for help.
Display stack trace? [yN]y
org.apache.tinkerpop.gremlin.jsr223.console.RemoteException: A timeout occurred within the script during evaluation of [RequestMessage{, > requestId=24c3d14c-c8be-4ed9-a297-3fd2b38ace9a, op='eval', processor='', args={gremlin=g.E().drop().iterate(), bindings={}, > batchSize=64}}] - consider increasing the timeout
at org.apache.tinkerpop.gremlin.console.jsr223.DriverRemoteAcceptor.submit(DriverRemoteAcceptor.java:178)
at org.apache.tinkerpop.gremlin.console.GremlinGroovysh.execute(GremlinGroovysh.groovy:99)
at org.codehaus.groovy.tools.shell.Shell.leftShift(Shell.groovy:122)
at org.codehaus.groovy.tools.shell.ShellRunner.work(ShellRunner.groovy:95)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$work(InteractiveShellRunner.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:145)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:165)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.work(InteractiveShellRunner.groovy:130)
at org.codehaus.groovy.tools.shell.ShellRunner.run(ShellRunner.groovy:59)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run(InteractiveShellRunner.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:145)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0(ScriptBytecodeAdapter.java:165)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.run(InteractiveShellRunner.groovy:89)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:236)
at org.apache.tinkerpop.gremlin.console.Console.(Console.groovy:146)
at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:236)
at org.apache.tinkerpop.gremlin.console.Console.main(Console.groovy:453)
gremlin>

我会说这是一个超时问题,对吗?

最佳答案

好的,在与 @stephen mallette 就问题的评论和 AWS 支持进行一些交流后,我终于找到了问题所在。
由于 NEPTUNE 仍然是预览版,因此仍然会遇到一些小问题,drop() 就是其中之一。
支持人员给出的解决方法是通过并行连接批量执行 drop():

g.V().limit(1000).drop()

因此,即使有 5 分钟超时和 700.000 个边,删除表现在也会超时。
我将在 NEPTUNE 发布时更新此答案。

关于python - 使用 pythongremlin 删除 AWS Neptune 上的所有边,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49877928/

相关文章:

Python 相当于 Ruby 的 'method_missing'

python - 如何在 python 中编写自定义编码来清理我的数据?

python - 黑盒功能的交互/交互

python - iloc'ing 多索引的一级

gremlin - 如何从gremlin中的顶点获取id和所有属性?

sql - Gremlin 如何像搜索功能一样查询相同的 sql

c# - Azure Cosmos 数据库引发套接字异常

gremlin - 如何获取 neptune db 中的顶点和边值

python - 如何在 python gremlin 中检索顶点的属性值

Gremlin 合并以添加多个顶点和边