Write to Dataset
The Write to Dataset operator writes data from an upstream operator to a dataset. The output dataset can then serve as an input for offline and real-time workflows. This topic describes how to configure the Write to Dataset operator.
Prerequisites
To use the workflow feature, your instance must have the Unstructured Data - Enterprise Edition, and your project must be bound to a real-time compute engine.
An offline or real-time workflow must exist. For more information, see Create and manage a workflow.
Limitations
The Write to Dataset operator can be used only in offline or real-time workflows.
Permissions
In a Basic project, project administrators, developers, analysts, and custom project roles with the Dataset-Use permission can use any dataset within the project as the operator's input or output.
Procedure
In the top navigation bar of the Dataphin homepage, choose Develop > Data Development.
On the Develop page, select a Project from the top navigation bar.
In the left-side navigation pane, choose Data Processing > Workflow. In the Workflow list, click the target offline or real-time workflow to open its canvas. From the Operator Library on the left, drag the Write to Dataset operator onto the canvas. In the Write to Dataset panel on the right, configure the following parameters.
Parameter
Description
Step name
The name can contain any characters and be up to 256 characters long.
Output configuration
Dataset
Select the dataset to which you want to write data. You can only select datasets in the current project that are designated for Offline or Real-time use. You can also select a specific Version. By default, the latest version is used.
File output path
The system automatically sets the file output path based on the selected dataset, but you can modify it.
Load policy
You can select Append data, Update on primary key conflict, or Overwrite. If the selected dataset and version are the same as those in a Read Dataset operator, only Update on primary key conflict is supported. Real-time datasets only support Append data. If the metadata table's storage type is Lindorm (wide table), it supports both Append data and Update on primary key conflict.
Append data: Appends new data to the destination table. If a primary key or constraint conflict occurs, the system reports an error.
Update on primary key conflict: If a primary key or constraint conflict occurs, the system deletes the existing row with the same primary key and then inserts the new data.
Overwrite: Deletes all data from the destination table before writing the new data.
Field mapping
Displays the output fields from the upstream operator. You can perform the following actions on the fields:
Output dataset field: Allows you to select a destination field for custom mapping. If the selected dataset and version are the same as those in a Read Dataset operator and the field is a primary key, you cannot modify the mapping.
File copy: This option is available only when the URL field originates from a Read Dataset operator. You can disable this option to perform a shallow copy. For URL fields from any other operator, a deep copy is mandatory.
Enabled (deep copy): Copies the file to the output dataset path and writes a new URL.
Disabled (shallow copy): Retains only the original URL reference and does not copy the file.
Add output field: Click to add a blank field mapping row.
Batch mapping: Lets you map fields in batches: manually, by name, or by position.
After you finish configuring the parameters, click Save in the toolbar at the top of the canvas to save your configuration.