El contenido no se encuentra disponible en el idioma seleccionado. Estamos trabajando continuamente para agregar más idiomas. Gracias por su apoyo.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ DataArts Studio/ User Guide/ DataArts Factory/ Usage Guidance/ Referencing Parameters in Scripts and Jobs

Referencing Parameters in Scripts and Jobs

Updated on 2024-10-23 GMT+08:00

This section describes how to reference parameters in scripts and jobs, application scope of the referenced parameters, and whether EL expressions and simple variable sets are supported, helping you better understand how to use workspace-level, script-level, and job-level parameters.

NOTE:

The application scopes of workspace environment variables, job parameters, and script parameters are different. If a workspace environment variable, a job parameter, and a script parameter have the same name, their priorities are as follows: job parameter > workspace environment variable > script parameter.

Table 1 Methods of using parameters

Type

Scenario

Scope

Calling Method

Environment variables/constants

When configuring job parameters, you can extract a parameter that belongs to multiple jobs as an environment variable.

Current workspace

${Environment variable}

${Environment constant}

For details about the configuration method, see Environment Variable.

Job variables/constants

Job parameters can be used in any node in jobs.

Current job

${Job variable}

${Job constant}

For details about the configuration method, see Configuring Job Parameters.

Script parameters

Set the name and value of a custom field.

Current script

${Script parameter}

For details about the configuration method, see Script Parameter.

NOTE:

Variables of an SQL script can be in ${} or ${dlf.} format. You can configure either type as needed. The configured variable format applies to SQL scripts, SQL statements in jobs, single-node jobs, and environment variables. For details about how to configure the script variable format, see Configuring Script Variables.

The default variable format is ${}.

Environment Variable

Variables and constants can be defined in environment variables. Environment variables take effect in current workspace.
  • The value of a variable (such as workspace name) varies depending on the workspace. When exporting a variable from a workspace and import it to another workspace, you must reconfigure its value.
  • The value of a constant in different workspaces is the same. When importing a constant to another workspace, you do not need to reconfigure its value.
Figure 1 Environment Variable

The specific application is as follows:

An environment variable has been added. The parameter name is sdqw and the parameter value is wqewqewqe.

  1. Open a created job and drag a Create OBS node from the node library to the canvas.
  2. On the Node Properties tab page, configure the node properties.

    Figure 2 Create OBS

  3. Click Save and then Monitor to monitor the running status of the job.

Configuring Job Parameters

Variables and constants can be defined in job parameters. Job parameters take effect in the current job.
  • The value of a variable varies depending on the job. You need to configure a value for the variable in each job.
  • The value of a constant in different jobs is the same. When importing a constant to another job, you do not need to reconfigure its value.
    Figure 3 Job parameter.

    After a job parameter is defined, it can be referenced by a job node.

    Figure 4 Using a Job Parameter Configuration

Script Parameter

  • Script parameters take effect in current script and it can be used in the following ways.
    • For SQL scripts, you can directly enter parameters in the script editor (not supported for Flink SQL scripts). During job scheduling, you can assign values to parameters through node attributes, as shown in 2.
    • For Shell scripts, you can enter a parameter and an interactive parameter in the upper part of the editor to transfer the parameters.
    • Python scripts support parameter transfer.
    • For SQL scripts, you can directly enter parameters in the script editor (not supported for Flink SQL scripts). When executing a script independently, you can configure parameters in the lower part of the editor shown in Figure 5.
      Figure 5 Configuring script parameters when executing a script independently

  1. Developing a Python Script During script development, the script expression must contain variables. For example, if the variable in the SQL statement is DATE, set this parameter to ${DATE} in the script. In the job parameter configuration, you can compile the statement expression of the script parameter Date in 2.
    On the script development page, enter development statements in the editor, as shown in the following figure.
    INSERT INTO B FROM (SELECT * FROM A WHERE DATE = ${DATE})
    Figure 6 Developing a script

    After the dws_030903 script is compiled, save and submit the latest version of the script.

  2. Develop batch jobs. When developing a job, you need to configure node attribute parameters.

    In the left navigation pane of DataArts Factory, choose Data Development > Develop Job.

    Figure 7 Configuring script parameters when the script is executed by job scheduling

    NOTE:
    • If the associated SQL script uses a parameter, the parameter name is displayed (DATA for example). Set the parameter value in the text box next to the parameter name. The parameter value can be an EL expression.
    • If the associated SQL script or script parameters change, you can click to synchronize the changes or click to edit the changes.
    • All nodes involving scripts, such as SQL scripts, shell scripts, and Python scripts, can use this method to reference script variables.

Simple Variable Set

The simple variable set provides a series of customized variables. Customized parameters are automatically replaced with specific values based on the service date, plan time, and parameter value format of task scheduling. In this way, parameters can be dynamically replaced during task scheduling. For details about the simple variable set, see Simple Variable Set.

Utilizamos cookies para mejorar nuestro sitio y tu experiencia. Al continuar navegando en nuestro sitio, tú aceptas nuestra política de cookies. Descubre más

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback