UpdateFile

Updated at:

Updates an existing file.

Operation description

When you debug or call this operation, the parameters you specify must be different from the original file configurations of the node. For example, if the value of a parameter for the source node is A, you must change the value to B before you submit the request. If you still specify A, an invalid exception is reported.

This operation is supported by DataWorks Basic Edition and higher editions.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dataworks:*

update

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

FileFolderPath

string

No

The path of the file.

Business_process/First_Business_Process/data_integration/Folder_1/Folder_2

ProjectId

integer

No

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

100001

FileName

string

No

The name of the file. You can change the file name by resetting the value of FileName. For example, you can call the ListFiles operation to query the ID of a file in the destination directory, and then call the UpdateFile operation to change the file name. When you call the UpdateFile operation, set the FileId parameter to the queried file ID and specify the FileName parameter.

ods_user_info_d

FileDescription

string

No

The description of the file.

Here is the file description

Content

string

No

The code content of the file. The code format varies based on the file type (fileType). To view the specific code format, you can go to Operation Center, right-click a task of the corresponding type, and select View Code.

SELECT "1";

AutoRerunTimes

integer

Yes

The number of automatic reruns after the file fails to run.

3

AutoRerunIntervalMillis

integer

No

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

This parameter corresponds to the Rerun Interval setting in Schedule Configuration > Time Attributes > Automatic Rerun after Error for a data development task in the DataWorks console. The time unit for Rerun Interval in the console is minutes. Convert the time accordingly when you call this operation.

120000

RerunMode

string

No

The rerun policy. Valid values:

  • ALL_ALLOWED: The task can be rerun after it succeeds or fails.

  • FAILURE_ALLOWED: The task cannot be rerun after it succeeds, but can be rerun after it fails.

  • ALL_DENIED: The task cannot be rerun regardless of whether it succeeds or fails.

This parameter corresponds to the Rerun Policy setting in Schedule Configuration > Time Attributes > Rerun Policy for a data development task in the DataWorks console.

Valid values:

  • ALL_ALLOWED :

    The task can be rerun after it succeeds or fails.

  • ALL_DENIED :

    The task cannot be rerun regardless of whether it succeeds or fails.

  • ALL_ALLOWD :

    The task can be rerun after it succeeds or fails.

  • FAILURE_ALLOWED :

    The task can be rerun only after it fails.

ALL_ALLOWED

Stop

boolean

No

Specifies whether to pause scheduling. Valid values:

  • true: Pause scheduling.

  • false: Do not pause scheduling.

This parameter corresponds to the Pause Scheduling setting in Schedule Configuration > Time Attributes > Schedule Type for a data development task in the DataWorks console.

false

ParaValue

string

No

The scheduling parameters.

This parameter corresponds to the Parameters setting in Schedule Configuration > Parameters for a data development task in the DataWorks console. For more information, see Scheduling parameters.

x=a y=b z=c

StartEffectDate

integer

No

The timestamp in milliseconds when automatic scheduling starts.

This parameter corresponds to the start time in the Effective Date setting in Schedule Configuration > Time Attributes > Effective Date for a data development task in the DataWorks console. The value is a timestamp in milliseconds.

936923400000

EndEffectDate

integer

No

The timestamp in milliseconds when automatic scheduling stops.

This parameter corresponds to the end time in the Effective Date setting in Schedule Configuration > Time Attributes > Effective Date for a data development task in the DataWorks console. The value is a timestamp in milliseconds.

4155787800000

CronExpress

string

No

The cron expression for periodic scheduling. This parameter corresponds to the Cron Expression setting in Schedule Configuration > Time Attributes > Cron Expression for a data development node in the DataWorks console. After you configure the scheduling cycle and scheduled time, DataWorks automatically generates the corresponding cron expression.

Examples:

  • Schedule a node at 05:30 every day: 00 30 05 * * ?.

  • Schedule a node at the 15th minute of every hour: 00 15 * * * ?.

  • Schedule a node every 10 minutes: 00 00/10 * * * ?.

  • Schedule a node every 10 minutes from 08:00 to 17:00 every day: 00 00-59/10 8-23 * * * ?.

  • Schedule a node at 00:20 on the 1st day of every month: 00 20 00 1 * ?.

  • Schedule a node every 3 months starting from 00:10 on January 1: 00 10 00 1 1-12/3 ?.

  • Schedule a node at 00:05 every Tuesday and Friday: 00 05 00 * * 2,5.

Due to the rules of the DataWorks scheduling system, cron expressions have the following limits:

  • The minimum scheduling interval is 5 minutes.

  • The earliest scheduling time of a day is 00:05.

00 00-59/5 1-23 * * ?

CycleType

string

No

The type of the scheduling cycle. Valid values: NOT_DAY (minute and hour) and DAY (day, week, and month).

This parameter corresponds to the Schedule Cycle setting in Schedule Configuration > Time Attributes > Schedule Cycle for a data development task in the DataWorks console.

Valid values:

  • NOT_DAY :

    Scheduled by minute or hour.

  • DAY :

    Scheduled by day, week, or month.

NOT_DAY

DependentType

string

No

The dependency on the previous cycle. Valid values:

  • SELF: Depend on the current node.

  • CHILD: Depend on the child nodes at the first level.

  • USER_DEFINE: Depend on other nodes.

  • NONE: Do not depend on the previous cycle.

Valid values:

  • CHILD_AND_SELF :

    Depend on the child nodes at the first level and the current node.

  • USER_DEFINE :

    Depend on other nodes.

  • SELF :

    Depend on the current node.

  • USER_DEFINE_AND_SELF :

    Depend on other nodes and the current node.

  • NONE :

    Do not depend on the previous cycle.

  • CHILD :

    Depend on the child nodes at the first level.

USER_DEFINE

DependentNodeIdList

string

No

If DependentType is set to USER_DEFINE, specify the IDs of the nodes on which this file depends. Separate multiple node IDs with commas (,).

This parameter corresponds to the configuration when you set Schedule Configuration > Scheduling Dependencies to Previous Cycle and select Other Nodes for the dependency for a data development node in the DataWorks console.

5,10,15,20

InputList

string

No

The output names of the upstream files on which the file depends. Separate multiple output names with commas (,).

This parameter corresponds to the Parent Node Output Name setting when you select Same Cycle for Schedule Configuration > Scheduling Dependencies for a data development task in the DataWorks console.

Note

This parameter is required when you create a batch synchronization task by calling the CreateDISyncTask and UpdateFile operations.

project_root,project.file1,project.001_out

ProjectIdentifier

string

No

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

You must specify either this parameter or the ProjectId parameter to determine the DataWorks workspace for this API call.

dw_project

FileId

integer

Yes

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

100000001

OutputList

string

No

The output of the file.

This parameter corresponds to the Output Name of Current Node setting when you select Same Cycle for Schedule Configuration > Scheduling Dependencies for a data development task in the DataWorks console.

dw_project.ods_user_info_d

ResourceGroupIdentifier

string

No

The resource group that is used to run the task after the file is published as a task. You can call the ListResourceGroups operation to obtain the list of available resource groups in the workspace.

default_group

ConnectionName

string

No

The identifier of the data source that is used by the task when the task corresponding to the file is run. You can call the ListDataSources operation to obtain the list of available data sources.

odps_source

Owner

string

No

The user ID of the file owner.

18023848927592

AutoParsing

boolean

No

Specifies whether to enable the automatic parsing feature for the file. Valid values:

  • true: The file automatically parses the code.

  • false: The file does not automatically parse the code.

This parameter corresponds to the Code Parsing setting when you select Same Cycle for Schedule Configuration > Scheduling Dependencies for a data development task in the DataWorks console.

true

SchedulerType

string

No

The scheduling type. Valid values:

  • NORMAL: Normal scheduling task.

  • MANUAL: Manual task. It is not scheduled on a daily basis and corresponds to a node under a manual workflow.

  • PAUSE: Paused task.

  • SKIP: Dry-run task. It is scheduled on a daily basis, but its status is directly set to successful when the scheduling is started.

Valid values:

  • PAUSE :

    Paused task.

  • SKIP :

    Dry-run task. It is scheduled on a daily basis, but its status is directly set to successful when the scheduling is started.

  • MANUAL :

    Manual task. It is not scheduled on a daily basis and corresponds to a node under a manual workflow.

  • NORMAL :

    Normal scheduling task.

NORMAL

AdvancedSettings

string

No

The advanced settings of the task.

This parameter corresponds to the Advanced Settings section in the right-side navigation pane of the edit page for EMR Spark Streaming and EMR Streaming SQL data development tasks in the DataWorks console.

Currently, only EMR Spark Streaming and EMR Streaming SQL tasks support this parameter, and the parameter value must be in JSON format.

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

StartImmediately

boolean

No

Specifies whether to start the task immediately after it is published. Valid values:

  • true: Start the task immediately after it is published.

  • false: Do not start the task immediately after it is published.

This parameter corresponds to the Startup Method setting in Configuration > Time Attributes > Startup Method in the right-side navigation pane of the edit page for EMR Spark Streaming and EMR Streaming SQL data development tasks in the DataWorks console.

true

InputParameters

string

No

The context input parameters of the node. The parameter value must be in JSON format. For the included fields, refer to the InputContextParameterList parameter structure in the response of the GetFile operation.

This parameter corresponds to the Input Parameters of Current Node setting in Schedule Configuration > Node Context > Input Parameters of Current Node for a data development task in the DataWorks console.

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

OutputParameters

string

No

The context output parameters of the node. The parameter value must be in JSON format. For the included fields, refer to the OutputContextParameterList parameter structure in the response of the GetFile operation.

This parameter corresponds to the Output Parameters of Current Node setting in Schedule Configuration > Node Context > Output Parameters of Current Node for a data development task in the DataWorks console.

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

IgnoreParentSkipRunningProperty

boolean

No

Specifies whether to skip the dry-run property of upstream nodes in Schedule Configuration > Previous Cycle.

true

ApplyScheduleImmediately

boolean

No

Specifies whether the scheduling configurations take effect immediately after the task is published.

true

Timeout

integer

No

The timeout definition in the scheduling configurations.

1

ImageId

string

No

The ID of the custom image.

m-uf6d7npxk1hhek8ng0cb

Response elements

Element

Type

Description

Example

object

The response.

HttpStatusCode

integer

The HTTP status code.

200

ErrorMessage

string

The error message.

The connection does not exist.

RequestId

string

The unique ID of the request. You can use the ID to troubleshoot issues when an error occurs.

0000-ABCD-EFGH-IJKLMNOPQ

ErrorCode

string

The error code.

Invalid.Tenant.ConnectionNotExists

Success

boolean

Indicates whether the call was successful. Valid values:

  • true: The call was successful.

  • false: The call failed.

true

Examples

Success response

JSON format

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

Error codes

HTTP status code

Error code

Error message

Description

500 InternalError.System An internal system error occurred. Try again later.
500 InternalError.UserId.Missing An internal system error occurred. Try again later.
403 Forbidden.Access Access is forbidden. Please first activate DataWorks Enterprise Edition or Flagship Edition.
429 Throttling.Api The request for this resource has exceeded your available limit.
429 Throttling.System The DataWorks system is busy. Try again later.
429 Throttling.User Your request is too frequent. Try again later.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.