ArangoDB 如何在arangoimport中使用选项--define?

vcudknz3  于 2022-12-09  发布在  Go
关注(0)|答案(1)|浏览(156)

documentation中,是否不清楚如何使用此选项?
难道是为了告诉阿兰戈:“嘿,请在导入时将此字段用作_from/_to字段”?

nmpmafwu

nmpmafwu1#

definestring…为配置文件中的@key@条目定义key=值
这与数据导入无关,arangodarangosh等都支持--define设置环境变量,可以在配置文件中使用占位符,如@FOO@,也可以在命令行中设置,如--define FOO=something
下面简要说明:https://www.arangodb.com/docs/stable/administration-configuration.html#environment-variables-as-parameters
示例配置文件 example.conf

[server]
endpoint = tcp://127.0.0.1:@PORT@

调用示例:

arangosh --config example.conf --define PORT=8529

对于带分隔符的源文件(CSV、TSV),可以使用选项--translate将列Map到不同的属性,例如--translate "child=_from" --translate "parent=_to"
https://www.arangodb.com/docs/stable/programs-arangoimport-examples-csv.html#attribute-name-translation
如果引用只是键,则可以使用--from-collection-prefixto-collection-prefix来预先挂起集合名称。
JSON输入不支持--translate。您可以使用驱动程序进行转换和导入,或以某种方式编辑源文件,或导入到集合中,然后使用AQL调整字段。

相关问题