If you want a node to use the data of its ancestor node, you can use an assignment node to pass the data. Assignment nodes support the Shell, ODPS SQL, and Python 2 languages and automatically add the outputs parameter based on value assignment rules. This helps nodes reference the data of their ancestor nodes. This topic describes how to use an assignment node.
Prerequisites
Only DataWorks of the Standard Edition or a more advanced edition supports assignment nodes.
Background information
- Dependencies between the assignment node and its ancestor and descendant nodes
In the preceding figure, three assignment nodes are created: fuzhi_python, fuzhi_sql, and fuzhi_shell. Before you use these assignment nodes, you must perform the following operations:
- Configure the start node as the ancestor node of the assignment nodes and the down_compare node as the descendant node of the assignment nodes to establish dependencies among all these nodes. The down_compare node references the outputs parameters of the assignment nodes.
- Before you configure the assignment nodes as the ancestor nodes of down_compare, commit the assignment nodes. This ensures that the outputs parameters of the assignment nodes can be parsed when you configure the down_compare node.
- Data passing relationships between the assignment node and its ancestor and descendant
nodes
After you configure Output Parameters for the assignment nodes and Input Parameters for down_compare, data passing and parameter reference relationships are established, as shown in the preceding figure.
- The outputs parameter that needs to be referenced by down_compare must be added to Output Parameters in the Parameters section of the Properties tab for each assignment node.
- The outputs parameter that needs to be referenced by down_compare must be added to Input Parameters in the Parameters section of the Properties tab for down_compare.
Note- For some nodes created in DataStudio, you do not need to configure assignment nodes if you want to transparently pass data between these nodes. You can manually add the outputs parameter to Output Parameters or Input Parameters for the nodes. The outputs parameter functions the same way as an assignment node. For example, you can manually add the outputs parameter to Output Parameters or Input Parameters only for the EMR Hive, EMR Spark SQL, ODPS Script, Hologres SQL, AnalyticDB for PostgreSQL, and MySQL nodes. For more information about how to add the outputs parameter, see Configure context-based parameters.
- If you want to transparently pass data between nodes for which you cannot manually add the outputs parameter to Output Parameters or Input Parameters, you must use assignment nodes.
- Assignment nodes can transparently pass data only to their Level-1 child nodes.
- Data passing verification (If the descendant nodes of the assignment node need to reference the data that is passed to the assignment node, and the descendant nodes and the assignment node need to be run at the same time, you can run all these nodes on their configuration tabs or in the Operation Center to check whether the assignment node can pass the data to the descendant nodes.)
- Relationships between the parameter output format of the assignment node and the way
the descendant nodes of the assignment node reference the outputs parameter
The following table describes the value assignment rules of the outputs parameter in the assignment nodes that use different languages.
Language Value of outputs Output format of outputs Size limit on the value of outputs ODPS SQL The data in the output of the SELECT statement in the last row is used as the value of the outputs parameter. This outputs parameter is added to Output Parameters for the assignment node. The data is passed to the descendant nodes of the assignment node as a two-dimensional array. The value size of the outputs parameter cannot exceed 2 MB. If the value size exceeds 2 MB, the assignment node fails to run. Shell The data in the output of the ECHO statement in the last row is used as the value of the outputs parameter. This outputs parameter is added to Output Parameters for the assignment node. The data is passed to the descendant nodes of the assignment node as a one-dimensional array whose elements are separated by commas (,). Python 2 The data in the output of the PRINT statement in the last row is used as the value of the outputs parameter. This outputs parameter is added to Output Parameters for the assignment node. The data is passed to the descendant nodes of the assignment node as a one-dimensional array whose elements are separated by commas (,).
Limits
Only DataWorks of the Standard Edition or a more advanced edition supports assignment nodes.Procedure
- Create assignment nodes and other nodes.
- Configure dependencies for the created nodes.
- Configure Output Parameters for fuzhi_sql and Input Parameters for down_compare.
- Configure Output Parameters for fuzhi_python and Input Parameters for down_compare.
- Configure Output Parameters for fuzhi_shell and Input Parameters for down_compare.
Create assignment nodes and other nodes
In this example, three assignment nodes that use different languages (Python 2, ODPS SQL, and Shell) are created: fuzhi_python, fuzhi_sql, and fuzhi_shell.
Configure dependencies for the created nodes

In addition, you can configure basic properties, time properties, and resource properties for all the nodes based on your business requirements. For more information, see Configure basic properties, Configure time properties, and Configure the resource group.
Configure Output Parameters for fuzhi_sql and Input Parameters for down_compare
This section describes how to configure Output Parameters for fuzhi_sql and Input Parameters for down_compare.
- Configure fuzhi_sql.
- Configure down_compare.
- Run the code and view the reference result.
- Click the
icon in the top toolbar.
- In the Warning message, click Continue to Run.
- View the reference result.
- Click the
Configure Output Parameters for fuzhi_python and Input Parameters for down_compare
This section describes how to configure Output Parameters for fuzhi_python and Input Parameters for down_compare.
- Configure fuzhi_python.
- Configure down_compare.
- Run the code and view the reference result.
- Click the
icon in the top toolbar.
- In the Warning message, click Continue to Run.
- View the reference result.
- Click the
Configure Output Parameters for fuzhi_shell and Input Parameters for down_compare
This section describes how to configure Output Parameters for fuzhi_shell and Input Parameters for down_compare.
- Configure fuzhi_shell.
- Configure down_compare.
- Run the code and view the reference result.
- Click the
icon in the top toolbar.
- In the Warning message, click Continue to Run.
- View the reference result.
- Click the