All Products
Search
Document Center

DataWorks:UpdateFile

Last Updated:Nov 21, 2024

Updates a file.

Operation description

When you debug or call this operation, you must specify new values for the specified parameters to ensure that the values are different from the original configurations of the file. For example, if the original value of a parameter is A, you must change the value of this parameter to B before you commit the node. If you set the parameter to A, an exception that indicates invalid data occurs.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
dataworks:*update
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
FileFolderPathstringNo

The path of the file.

ProjectIdlongNo

The ID of the DataWorks workspace. You can log on to the DataWorks console and go to the Workspace Management page to obtain the workspace ID.

10000
FileNamestringNo

The name of the file. You can set the FileName parameter to a new value to change the file name.

You can call the ListFiles operation to query the ID of the file whose name you want to change. Then, you can set the FileId parameter to the ID and set the FileName parameter to a new value when you call the UpdateFile operation.

ods_user_info_d
FileDescriptionstringNo

The description of the file.

ContentstringNo

The code of the file. The code format varies based on the file type. To view the code format for a specific file type, go to Operation Center, right-click a node of the file type, and then select View Code.

SELECT "1";
AutoRerunTimesintegerYes

The number of automatic reruns that are allowed after an error occurs.

3
AutoRerunIntervalMillisintegerNo

The interval between two consecutive automatic reruns after an error occurs. Unit: milliseconds. Maximum value: 1800000 (30 minutes).

This parameter corresponds to the Rerun Interval parameter that is displayed after the Auto Rerun upon Error check box is selected in the Schedule section of the Properties tab in the DataWorks console.

The interval that you specify in the DataWorks console is measured in minutes. Pay attention to the conversion between the units of time when you call the operation.

120000
RerunModestringNo

Specifies whether the node that corresponds to the file can be rerun. Valid values:

  • ALL_ALLOWED: The node can be rerun regardless of whether it is successfully run or fails to run.
  • FAILURE_ALLOWED: The node can be rerun only after it fails to run.
  • ALL_DENIED: The node cannot be rerun regardless of whether it is successfully run or fails to run.

This parameter corresponds to the Rerun parameter in the Schedule section of the Properties tab in the DataWorks console.

Enumeration Value:
  • ALL_ALLOWD
  • FAILURE_ALLOWED
  • ALL_DENIED
  • ALL_ALLOWED
ALL_ALLOWED
StopbooleanNo

Specifies whether to suspend the scheduling of the node. Valid values:

  • true: suspends the scheduling of the node.
  • false: does not suspend the scheduling of the node.

This parameter corresponds to the Recurrence parameter in the Schedule section of the Properties tab in the DataWorks console.

false
ParaValuestringNo

The scheduling parameters of the node.

This parameter corresponds to the Parameters section of the Properties tab in the DataWorks console. For more information, see Configure scheduling parameters.

x=a y=b z=c
StartEffectDatelongNo

The start time of automatic scheduling. Set this parameter to a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

This parameter corresponds to the Validity Period parameter in the Schedule section of the Properties tab in the DataWorks console.

936923400000
EndEffectDatelongNo

The end time of automatic scheduling. Set this parameter to a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

This parameter corresponds to the end time specified for the Validity Period parameter in the Schedule section of the Properties tab in the DataWorks console.

4155787800000
CronExpressstringNo

The CRON expression that represents the periodic scheduling policy of the node. This parameter corresponds to the Cron Expression parameter in the Schedule section of the Properties tab in the DataWorks console. After you configure the Scheduling Cycle and Run At parameters in the DataWorks console, DataWorks automatically generates a value for the Cron Expression parameter.

Examples:

  • CRON expression for a node that is scheduled to run at 05:30 every day: 00 30 05 * * ?
  • CRON expression for a node that is scheduled to run at the fifteenth minute of each hour: 00 15 * * * ?
  • CRON expression for a node that is scheduled to run every 10 minutes: 00 00/10 * * * ?
  • CRON expression for a node that is scheduled to run every 10 minutes from 08:00 to 17:00 every day: 00 00-59/10 8-23 * * * ?
  • CRON expression for a node that is scheduled to run at 00:20 on the first day of each month: 00 20 00 1 * ?
  • CRON expression for a node that is scheduled to run every three months starting from 00:10 on January 1: 00 10 00 1 1-12/3 ?
  • CRON expression for a node that is scheduled to run at 00:05 every Tuesday and Friday: 00 05 00 * * 2,5

The scheduling system of DataWorks imposes the following limits on CRON expressions:

  • A node can be scheduled to run at a minimum interval of 5 minutes.
  • A node can be scheduled to run at 00:05 every day at the earliest.
00 00-59/5 1-23 * * ?
CycleTypestringNo

The type of the scheduling cycle of the node that corresponds to the file. Valid values: NOT_DAY and DAY. The value NOT_DAY indicates that the node is scheduled to run by minute or hour. The value DAY indicates that the node is scheduled to run by day, week, or month.

This parameter corresponds to the Scheduling Cycle parameter in the Schedule section of the Properties tab in the DataWorks console.

NOT_DAY
DependentTypestringNo

The type of the cross-cycle scheduling dependency of the node that corresponds to the file. Valid values:

  • SELF: The instance generated for the node in the current cycle depends on the instance generated for the node in the previous cycle.
  • CHILD: The instance generated for the node in the current cycle depends on the instances generated for the descendant nodes at the nearest level of the node in the previous cycle.
  • USER_DEFINE: The instance generated for the node in the current cycle depends on the instances generated for one or more specified nodes in the previous cycle.
  • NONE: No cross-cycle scheduling dependency type is selected for the node.
USER_DEFINE
DependentNodeIdListstringNo

The ID of the node on which the node corresponding to the file depends when the DependentType parameter is set to USER_DEFINE. Multiple IDs are separated by commas (,).

The value of this parameter corresponds to the ID of the node that you specified after you select Previous Cycle and set Depend On to Other Nodes in the Dependencies section of the Properties tab in the DataWorks console.

5,10,15,20
InputListstringNo

The output name of the parent file on which the current file depends. If you specify multiple output names, separate them with commas (,).

This parameter corresponds to the Parent Nodes parameter that is displayed after you select Same Cycle in the Dependencies section of the Properties tab in the DataWorks console.

Note You must configure this parameter when you call the CreateDISyncTask or UpdateFile operation to create a batch synchronization task.
project_root,project.file1,project.001_out
ProjectIdentifierstringNo

The name of the DataWorks workspace. You can log on to the DataWorks console and go to the Workspace Management page to obtain the workspace name.

You must configure this parameter or the ProjectId parameter to determine the DataWorks workspace to which the operation is applied.

dw_project
FileIdlongYes

The ID of the file. You can call the ListFiles operation to obtain the ID.

100000001
OutputListstringNo

The output name of the current file.

This parameter corresponds to the Output Name parameter in the Dependencies section of the Properties tab in the DataWorks console.

dw_project.ods_user_info_d
ResourceGroupIdentifierstringNo

The identifier of the resource group that is used to run the node. You can call the ListResourceGroups operation to query the available resource groups in the workspace.

default_group
ConnectionNamestringNo

The name of the connected data source that is used to run the node. You can call the ListDataSources operation to query the available data sources of the workspace.

odps_first
OwnerstringNo

The ID of the file owner.

18023848927592
AutoParsingbooleanNo

Specifies whether the automatic parsing feature is enabled for the file. Valid values:

  • true: The automatic parsing feature is enabled for the file.
  • false: The automatic parsing feature is not enabled for the file.

This parameter corresponds to the Analyze Code parameter that is displayed after Same Cycle is selected in the Dependencies section of the Properties tab in the DataWorks console.

true
SchedulerTypestringNo

The scheduling type of the node. Valid values:

  • NORMAL: The node is an auto triggered node.
  • MANUAL: The node is a manually triggered node. Manually triggered nodes cannot be automatically triggered. They correspond to the nodes in the Manually Triggered Workflows pane.
  • PAUSE: The node is a paused node.
  • SKIP: The inner node is a dry-run node. Dry-run nodes are started as scheduled but the scheduling system sets the status of the nodes to succeeded when the scheduling system starts to run the nodes.
NORMAL
AdvancedSettingsstringNo

The advanced configurations of the node.

This parameter is valid only for an EMR Spark Streaming node or an EMR Streaming SQL node. This parameter corresponds to the Advanced Settings tab of the node in the DataWorks console.

This parameter is configured in the JSON format.

{"queue":"default","SPARK_CONF":"--conf spark.driver.memory=2g"}
StartImmediatelybooleanNo

Specifies whether to immediately run a node after the node is deployed to the production environment. Valid values:

  • true: A node is immediately run after the node is deployed to the production environment.
  • false: A node is not immediately run after the node is deployed to the production environment.

This parameter is valid only for an EMR Spark Streaming node or an EMR Streaming SQL node. This parameter corresponds to the Start Method parameter in the Schedule section of the Configure tab in the DataWorks console.

true
InputParametersstringNo

The input parameters of the node. This parameter is configured in the JSON format. For more information about the input parameters, refer to the InputContextParameterList parameter in the Response parameters section of the GetFile operation.

This parameter corresponds to the Input Parameters table in the Input and Output Parameters section of the Properties tab in the DataWorks console.

[{"ValueSource": "project_001.first_node:bizdate_param","ParameterName": "bizdate_input"}]
OutputParametersstringNo

The output parameters of the node. This parameter is configured in the JSON format. For more information about the output parameters, refer to the OutputContextParameterList parameter in the Response parameters section of the GetFile operation.

This parameter corresponds to the Output Parameters table in the Input and Output Parameters section of the Properties tab in the DataWorks console.

[{"Type": 1,"Value": "${bizdate}","ParameterName": "bizdate_param"}]

Response parameters

ParameterTypeDescriptionExample
object
HttpStatusCodeinteger

The HTTP status code returned.

200
ErrorMessagestring

The error message returned.

The connection does not exist.
RequestIdstring

The ID of the request. You can use the ID to troubleshoot issues.

0000-ABCD-EFGH-IJKLMNOPQ
ErrorCodestring

The error code returned.

Invalid.Tenant.ConnectionNotExists
Successboolean

Indicates whether the request is successful. Valid values:

  • true: The request is successful.
  • false: The request fails.
true

Examples

Sample success responses

JSONformat

{
  "HttpStatusCode": 200,
  "ErrorMessage": "The connection does not exist.",
  "RequestId": "0000-ABCD-EFGH-IJKLMNOPQ",
  "ErrorCode": "Invalid.Tenant.ConnectionNotExists",
  "Success": true
}

Error codes

HTTP status codeError codeError messageDescription
403Forbidden.AccessAccess is forbidden. Please first activate DataWorks Enterprise Edition or Flagship Edition.No permission, please authorize
429Throttling.ApiThe request for this resource has exceeded your available limit.-
429Throttling.SystemThe DataWorks system is busy. Try again later.-
429Throttling.UserYour request is too frequent. Try again later.-
500InternalError.SystemAn internal system error occurred. Try again later.-
500InternalError.UserId.MissingAn internal system error occurred. Try again later.-

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-09-02The Error code has changed. The request parameters of the API has changedView Change Details
2024-04-03The Error code has changedView Change Details
2023-07-14The Error code has changedView Change Details
2023-04-25The Error code has changed. The request parameters of the API has changedView Change Details