Bu sayfa henüz yerel dilinizde mevcut değildir. Daha fazla dil seçeneği eklemek için yoğun bir şekilde çalışıyoruz. Desteğiniz için teşekkür ederiz.

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
On this page

Expression Use Example

Updated on 2022-08-17 GMT+08:00

With this example, you can understand how to use EL expressions in the following applications:

  • Using variables in the SQL script of DataArts Factory
  • Transferring parameters to SQL script variables?
  • Using EL expressions in parameters?

Context

Use the job orchestration and job scheduling functions to generate daily transaction statistics reports according to transaction details tables.

The tables involved in this example are as follows:

  • trade_log: This table records data generated in each transaction.
  • trade_report: This table is generated based on trade_log and records the daily transaction summary.

Prerequisites

  • A DLI data connection named dli_demo has been created.

    If this data connection is not created, create one. For details, see Creating Data Connections.

  • A database named dli_db has been created in DLI.

    If this database is not created, create one. For details, see Creating a Database.

  • Tables trade_log and trade_report have been created in the dli_db database.

    If the tables are not created, create them. For details, see Creating a Table.

Procedure

  1. Create and develop a SQL script.

    1. In the navigation tree of the DataArts Factory console, choose Data Development > Develop Script.
    2. Access the area on the right and choose Create SQL Script > DLI.
    3. Go to the SQL script development page and set the data connection, database, and resource queue on the script property bar.
    4. Enter the following SQL statements in the script editor:

      INSERT OVERWRITE TABLE trade_report
      SELECT
        sum(trade_count),
        '${yesterday}'
      FROM
        trade_log
      where
        date_format(trade_time, 'yyyy-MM-dd') = '${yesterday}'
    5. Click and set the script name to generate_trade_report.

  2. Create and develop a job.

    1. In the navigation tree of the DataArts Factory console, choose Data Development > Develop Job.
    2. Access the area on the right and click Create Job to create an empty job named job.
    3. Go to the job development page, drag the DLI SQL node to the canvas, click the icon, and configure node properties.

      Description of key properties:

      • SQL Script: SQL script generate_trade_report that is developed in 1.
      • Database Name: Database configured in SQL script generate_trade_report.
      • Queue Name: Resource queue configured in SQL script generate_trade_report.
      • Script Parameter: Parameter yesterday configured in SQL script generate_trade_report. Enter the following EL expression as the parameter values:
        #{Job.getYesterday("yyyy-MM-dd")}

        Expression Description: The job object uses the getYesterday method to obtain the time of the day before the job plan execution time. The time format is yyyy-MM-dd.

        If the job plan time is 2018/9/26 01:00:00, the calculation result of this expression is 2018-09-25. The calculation result will replace the value of parameter ${yesterday} in the SQL script. The SQL statements after the replacement are as follows:

        INSERT OVERWRITE TABLE trade_report
        SELECT
          sum(trade_count),
          '2018-09-25'
        FROM
          trade_log
        where
          date_format(trade_time, 'yyyy-MM-dd') = '2018-09-25'
    4. Click to test the running job.
    5. After the job test is complete, click to save the job configuration.

Sitemizi ve deneyiminizi iyileştirmek için çerezleri kullanırız. Sitemizde tarama yapmaya devam ederek çerez politikamızı kabul etmiş olursunuz. Daha fazla bilgi edinin

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback