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
Situation Awareness
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

Developing a DWS SQL Job

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

This section describes how to use the DWS SQL operator to develop a job on DataArts Factory.

Scenario

This tutorial describes how to develop a DWS job to collect the sales volume of a store on the previous day.

Preparing the Environment

  • Enable DWS and create a DWS cluster for running DWS SQL jobs.
  • Enable CDM incremental packages and create a CDM cluster.

    Ensure that the VPC, subnet, and security group of the CDM cluster are the same as those of the DWS cluster so that the two clusters can communicate with each other.

Creating a DWS Data Connection

Before developing a DWS SQL job, you must create a data connection to DWS on the Manage Data Connections page of Management Center. The data connection name is dws_link.

The key parameters are as follows:

  • Cluster Name: Select the DWS cluster you have created when preparing the environment.
  • Agent: Select the CDM cluster you have created when preparing the environment.

Creating a Database

Create a gaussdb database by following the instructions in Creating a Database.

Creating Data Tables

Create tables trade_log and trade_report in the gaussdb database. The following is an example script for creating the tables:

create schema store_sales;
set current_schema= store_sales;
drop table if exists trade_log;
CREATE TABLE trade_log
(
        sn           VARCHAR(16), 
        trade_time   DATE,
        trade_count   INTEGER(8)        
);
set current_schema= store_sales;
drop table if exists trade_report;
CREATE TABLE trade_report
( 
        rq   DATE,
        trade_total   INTEGER(8)        
);

Developing a DWS SQL Script

Choose Development > Develop Script and create a DWS SQL script named dws_sql. Enter an SQL statement in the editor to collect the sales amount of the previous day.

Figure 1 Developing a script

Key notes:

  • The script development area in Figure 1 is a temporary debugging area. After you close the script tab, the development area will be cleared. You can click Submit to save and submit a script version.
  • Connection: Select the data connection created in Creating a DWS Data Connection.

Developing a DWS SQL Job

After developing the DWS SQL script, create a job for periodically executing the DWS SQL script.

  1. Create an empty job named job_dws_sql.

    Figure 2 Creating the job_dws_sql job

  2. Go to the job development page, drag the DWS SQL node to the canvas, and click the node to configure its properties.

    Figure 3 Configuring properties for the DWS SQL node

    Key properties:

    • SQL script: Associate with the dws_sql script developed in Developing a DWS SQL Script.
    • Data Connection: Select the data connection configured in the dws_sql script. The data connection can be changed.
    • Database: Select the database configured in the dws_sql script. The database can be changed.
    • Script Parameter: Obtain the value of yesterday using the following EL expression:
      #{Job.getYesterday("yyyy-MM-dd")}
    • Node Name: The name of the dws_sql script is displayed by default. The name can be changed.

  3. After configuring the job, click to test it.
  4. If the test is successful, click the blank area on the canvas and then the Scheduling Setup tab on the right. On the displayed page, configure the scheduling policy.

    Figure 4 Configuring the scheduling policy

    Parameter descriptions:

    From Aug 6 to Aug 31 in 2021, the job was executed once at 02:00 every day.

  5. Click Submit and then Execute. The job will be executed automatically every day.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback