添加额外 属性 到 Neptune 数据库
Add Additional Property to Neptune DB
我正在尝试向现有顶点和边添加名为“insert_date”的额外 属性。我试过了
g.V().setProperty('insert_date',datetime('2020-10-06'))
错误:
{
"requestId": "33cf8df5-3cbe-41ac-b650-5752debec04d",
"code": "MalformedQueryException",
"detailedMessage": "Query parsing failed at line 1, character position at 10, error message : token recognition error at: 'rop'"
}
我正在尝试从 Neptune Notebook 执行上述命令。
它只是用 insert_date 属性 添加了新的顶点。但是我没有找到改变现有顶点或边的方法。
如果可行请提出建议。因为我想实现增量提取,所以我每次 运行 ETL 时只能提取新的顶点或边。
谢谢
下面的命令用于向现有图形添加其他属性。
g.V().property("insert_date","2020-01-01 00:00:00")
要将 属性 添加到 Gremlin 中的现有顶点,请使用 property() 步骤。例如,如果您想将 属性 insert_date
添加到 ID 为 A
的顶点,您将使用以下语句:
g.V('A').property('insert_date', '2020-10-06')
property()
步骤会将指定的 属性 添加或更新为新值。对于传入的所有当前元素都会发生这种情况。例如,如果您只想更新没有 insert_date
属性 的元素,您可以通过以下方式执行此操作:
g.V().hasNot('insert_date').property('insert_date', '2020-10-06')
在每个示例中,属性 将作为值数组的一部分添加。如果您想将 属性 设置为只包含一个值,那么您可以使用 property()
步骤重载,它采用这样的基数:
g.V('A').property(Cardinality.single, 'insert_date', '2020-10-06')
在上面列出的代码中需要注意一件事。虽然 Neptune 确实支持 string-based 查询的 datetime()
函数,但如果您不使用 GLV,则需要创建此值并传入本机 Date/Time,如 here.
我正在尝试向现有顶点和边添加名为“insert_date”的额外 属性。我试过了
g.V().setProperty('insert_date',datetime('2020-10-06'))
错误:
{
"requestId": "33cf8df5-3cbe-41ac-b650-5752debec04d",
"code": "MalformedQueryException",
"detailedMessage": "Query parsing failed at line 1, character position at 10, error message : token recognition error at: 'rop'"
}
我正在尝试从 Neptune Notebook 执行上述命令。
它只是用 insert_date 属性 添加了新的顶点。但是我没有找到改变现有顶点或边的方法。
如果可行请提出建议。因为我想实现增量提取,所以我每次 运行 ETL 时只能提取新的顶点或边。
谢谢
下面的命令用于向现有图形添加其他属性。
g.V().property("insert_date","2020-01-01 00:00:00")
要将 属性 添加到 Gremlin 中的现有顶点,请使用 property() 步骤。例如,如果您想将 属性 insert_date
添加到 ID 为 A
的顶点,您将使用以下语句:
g.V('A').property('insert_date', '2020-10-06')
property()
步骤会将指定的 属性 添加或更新为新值。对于传入的所有当前元素都会发生这种情况。例如,如果您只想更新没有 insert_date
属性 的元素,您可以通过以下方式执行此操作:
g.V().hasNot('insert_date').property('insert_date', '2020-10-06')
在每个示例中,属性 将作为值数组的一部分添加。如果您想将 属性 设置为只包含一个值,那么您可以使用 property()
步骤重载,它采用这样的基数:
g.V('A').property(Cardinality.single, 'insert_date', '2020-10-06')
在上面列出的代码中需要注意一件事。虽然 Neptune 确实支持 string-based 查询的 datetime()
函数,但如果您不使用 GLV,则需要创建此值并传入本机 Date/Time,如 here.