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
Help Center/ DataArts Studio/ Best Practices/ Advanced Data Migration Guidance/ Recording the Time When Data Is Written to the Database

Recording the Time When Data Is Written to the Database

Updated on 2024-11-12 GMT+08:00

When you create a job on the CDM console to migrate tables or files of a relational database, you can add a field to record the time when they were written to the database.

Prerequisites

  • A link has been created, and the source end of the connector is a relational database.
  • The destination data table contains a date and time field or timestamp field. In the automatic table creation scenario, you need to manually create the date and time field or timestamp field in the destination table in advance.

Creating a Table/File Migration Job

  1. Create a table/file migration job, and select the created source connector and destination connector.

    Figure 1 Configuring the job

  2. Click Next to go to the Map Field page and click .

    Figure 2 Configuring field mapping

  3. Click the Custom Fields tab, set the field name and value, and click OK.

    Name: Enter InputTime.

    Value: Enter ${timestamp()}. For more time macro variables, see Table 1.
    Figure 3 Add Field
    Table 1 Macro variable definition of time and date

    Macro Variable

    Description

    Display Effect

    ${dateformat(yyyy-MM-dd)}

    Returns the current date in yyyy-MM-dd format.

    2017-10-16

    ${dateformat(yyyy/MM/dd)}

    Returns the current date in yyyy/MM/dd format.

    2017/10/16

    ${dateformat(yyyy_MM_dd HH:mm:ss)}

    Returns the current time in yyyy_MM_dd HH:mm:ss format.

    2017_10_16 09:00:00

    ${dateformat(yyyy-MM-dd HH:mm:ss, -1, DAY)}

    Returns the current time in yyyy-MM-dd HH:mm:ss format. The date is one day before the current day.

    2017-10-15 09:00:00

    ${dateformat(yyyy-MM-dd, -1, DAY)} 00:00:00

    Returns 00:00:00 of the day before the current day in yyyy-MM-dd HH:mm:ss format.

    2017-10-15 00:00:00

    ${dateformat(yyyy-MM-dd, -1, DAY)} 12:00:00

    Returns 12:00:00 of the day before the current day in yyyy-MM-dd HH:mm:ss format.

    2017-10-15 12:00:00

    ${dateformat(yyyy-MM-dd, -N, DAY)} 00:00:00

    Returns 00:00:00 of the day N days before the current day in yyyy-MM-dd HH:mm:ss format.

    When N is 3:

    2017-10-13 00:00:00

    ${dateformat(yyyy-MM-dd, -N, DAY)} 12:00:00

    Returns 12:00:00 of the day N days before the current day in yyyy-MM-dd HH:mm:ss format.

    When N is 3:

    2017-10-13 12:00:00

    ${timestamp()}

    Returns the timestamp of the current time, that is, the number of milliseconds that have elapsed since 00:00:00 on January 1, 1970.

    1508115600000

    ${timestamp(-10, MINUTE)}

    Returns the timestamp generated 10 minutes before the current time point.

    1508115000000

    ${timestamp(dateformat(yyyyMMdd))}

    Returns the timestamp of 00:00:00 of the current day.

    1508083200000

    ${timestamp(dateformat(yyyyMMdd,-1,DAY))}

    Returns the timestamp of 00:00:00 of the previous day.

    1507996800000

    ${timestamp(dateformat(yyyyMMddHH))}

    Returns the timestamp of the current hour.

    1508115600000

    NOTE:
    • After a field is added, its sample value is not displayed on the console. This does not affect the field value transmission. CDM directly writes the field value to the destination end.
    • The Custom Fields tab is available only when the source connector is JDBC, HBase, MongoDB, Elasticsearch, or Kafka, or the destination connector is HBase.
    • After adding the fields, ensure that the customized import time field matches the field type of the destination table.

  4. Click Next and set task parameters. Generally, retain the default values of all parameters.
  5. Click Save and Run. On the Table/File Migration page, you can view the job execution progress and result.
  6. After the job is successfully executed, in the Operation column of the job, click Historical Record to view the job's historical execution records and read/write statistics.

    On the Historical Record page, click Log to view the job logs.

  7. Go to the destination data source to check the time when the data is imported to the database.

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