Gremlin:如何使用python进行IO导入 [英] Gremlin: how works IO import with python

查看:48
本文介绍了Gremlin:如何使用python进行IO导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图知道从命令g.io('file.json').read().iterate()调用的函数是什么我看到在step_instructions中放入了读取"步骤,但找不到将文件导入到图形中的原始函数.

I am trying to know what are the functions called from the command g.io('file.json').read().iterate() I see that a 'read' step is put in the step_instructions but I can't found the original function to import the file in to the graph.

这是因为我想使用python对象导入很多数据,但没有文件.我看到io().read()在一分钟内导入了一个大文件,我想重新创建它而不使用文件.

This because I want to import a lot of data but without a file, using a python object. I see that io().read() import a big file in a minute and I want to ricreate it but without using a file.

非常感谢.

推荐答案

首先要清楚地命名, io()是一个步骤,而 read() write()是步进调制器,并且这些调制器只能应用于 io()步进以分别告诉其读取或写入.因此,由于 io()当前仅适用于字符串文件名,因此您只能从文件中读取/写入文件.

First of all to be clear on the nomenclature, io() is a step, while read() and write() are step modulators and those modulators can only apply to io() step to tell it to read or write respectively. Therefore, as io() currently only works with a string file name consequently you can only read/write from/to files.

如果您要发送大量数据",在使用Python之前,我首先会考虑您所说的大小.如果要说的是数百万个顶点和边,则应首先检查所使用的图形数据库是否具有自己的批量加载工具.如果是这样,您应该使用它.对于JanusGraph,您也可以考虑此处所述的使用Gremlin/Spark的方法.最后,如果必须使用纯Gremlin进行批量加载,则可以使用Python对象(我​​假设某种 list / dict )进行参数化遍历采取.此博客帖子可能会在该行中提供一些启发思考.

If you want to send "a lot of data" with Python, I'd first consider what you mean by that in size. If you're talking millions of vertices and edges, you should first check if the graph database you are using has its own bulk loading tool. If it does, you should use that. You may also consider methods using Gremlin/Spark as described here in the case of JanusGraph. Finally, if you must use pure Gremlin to do your bulk loading, then parameterized traversal with your Python object (I assume a list/dict of some sort) is probably the approach to take. This blog post might offer some inspiration in that line of thinking.

这篇关于Gremlin:如何使用python进行IO导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆