跳至主要内容

追加到数据集节点

Append to Dataset Node Screenshot

概述

Append to Dataset节点用于向指定数据集追加一行数据。当您想要向现有数据集添加新数据以进行进一步处理或分析时,此节点特别有用。

节点在运行图时需要上下文中有一个可用的数据集提供者。数据集提供者负责管理数据集的存储和检索。在Rivet应用程序中,数据集提供者会自动为您处理。

有关数据集的更多信息,请参阅用户指南中的Data Studio部分。

输入项

标题数据类型描述默认值备注
Datastring or string[]The data to be appended to the dataset. Each entry in the array corresponds to a column in the new row in the dataset.(required)The input will be coerced into a string array if it is not a string array.
IDstringThe ID for the new row of data. If not provided, a new ID will be generated.(Automatically generated)The input will be coerced into a string if it is not a string.
EmbeddingvectorAn optional vector that can be associated with the new row of data.(empty)The input will be coerced into a vector if it is not a vector.
Dataset IDstringThe ID of the dataset to append to. This input is only available if Use Dataset ID Input is enabled.(required if if the input toggle for Dataset ID is enabled)The input will be coerced into a string if it is not a string.

示例1:向数据集追加数据

  1. 创建一个Array Node并将值设置为["John Doe", "30", "Engineer"]
  2. Data Studio中,创建一个ID为employees的新数据集。
  3. 创建一个Append to Dataset节点并将Dataset ID设置为employees
  4. 将Array节点连接到Append to Dataset节点的Data输入端口。
  5. 运行图表。Append to Dataset节点的Dataset输出应包含已追加到employees数据集的新数据行。

Append to Dataset Node Example 1.1 Append to Dataset Node Example 1.2

错误处理

如果运行图表时上下文中数据集提供程序不可用,Append to Dataset节点将报错。如果未提供Data输入,它也会报错。

常见问题

问:什么是数据集提供者?

A: 数据集提供者是一个负责管理数据集存储和检索的对象。当图表运行时,它会被传递给上下文。数据集提供者必须实现DatasetProvider接口,该接口包含获取、存放和删除数据集的方法。更多信息请参阅API参考文档

问:我可以一次性向多个数据集追加数据吗?

答:不可以,Append to Dataset节点每次只能向一个数据集追加数据。如果您需要向多个数据集追加数据,可以使用多个Append to Dataset节点。

问:如果数据集不存在会发生什么?

A: 如果数据集不存在,Append to Dataset Node 将会报错。

另请参阅