- What's New
- Function Overview
- Service Overview
- Getting Started
-
User Guide
- Permissions Management
- Supported Data Sources
- Creating and Managing a CDM Cluster
-
Creating a Link in a CDM Cluster
- Creating a Link Between CDM and a Data Source
-
Configuring Link Parameters
- OBS Link Parameters
- PostgreSQL/SQLServer Link Parameters
- GaussDB(DWS) Link Parameters
- RDS for MySQL/MySQL Database Link Parameters
- Oracle Database Link Parameters
- DLI Link Parameters
- Hive Link Parameters
- HBase Link Parameters
- HDFS Link Parameters
- FTP/SFTP Link Parameters
- Redis Link Parameters
- DDS Link Parameters
- CloudTable Link Parameters
- MongoDB Link Parameters
- Cassandra Link Parameters
- DIS Link Parameters
- Kafka Link Parameters
- DMS Kafka Link Parameters
- CSS Link Parameters
- Elasticsearch Link Parameters
- Dameng Database Link Parameters
- SAP HANA Link Parameters
- Shard Link Parameters
- MRS Hudi Link Parameters
- MRS ClickHouse Link Parameters
- ShenTong Database Link Parameters
- LogHub (SLS) Link Parameters
- Doris Link Parameters
- YASHAN Link Parameters
- Uploading a CDM Link Driver
- Creating a Hadoop Cluster Configuration
-
Creating a Job in a CDM Cluster
- Table/File Migration Jobs
- Creating an Entire Database Migration Job
-
Configuring CDM Source Job Parameters
- From OBS
- From HDFS
- From HBase/CloudTable
- From Hive
- From DLI
- From FTP/SFTP
- From HTTP
- From PostgreSQL/SQL Server
- From DWS
- From SAP HANA
- From MySQL
- From Oracle
- From a Database Shard
- From MongoDB/DDS
- From Redis
- From DIS
- From Kafka/DMS Kafka
- From Elasticsearch or CSS
- From MRS Hudi
- From MRS ClickHouse
- From a Dameng Database
- From LogHub (SLS)
- From a ShenTong Database
- From Doris
- From YASHAN
- Configuring CDM Destination Job Parameters
- Configuring CDM Job Field Mapping
- Configuring a Scheduled CDM Job
- Managing CDM Job Configuration
- Managing a CDM Job
- Managing CDM Jobs
- Viewing Traces
-
Key Operation Guide
- Incremental Migration
- Using Macro Variables of Date and Time
- Migration in Transaction Mode
- Encryption and Decryption During File Migration
- MD5 Verification
- Configuring Field Converters
- Adding Fields
- Migrating Files with Specified Names
- Regular Expressions for Separating Semi-structured Text
- Recording the Time When Data Is Written to the Database
- File Formats
- Converting Unsupported Data Types
-
Tutorials
- Creating an MRS Hive Link
- Creating a MySQL Link
- Migrating Data from MySQL to MRS Hive
- Migrating Data from MySQL to OBS
- Migrating Data from MySQL to DWS
- Migrating an Entire MySQL Database to RDS
- Migrating Data from Oracle to CSS
- Migrating Data from Oracle to DWS
- Migrating Data from OBS to CSS
- Migrating Data from OBS to DLI
- Migrating Data from MRS HDFS to OBS
- Migrating the Entire Elasticsearch Database to CSS
-
Best Practices
-
Tutorials
- Creating an MRS Hive Link
- Creating a MySQL Link
- Migrating Data from MySQL to MRS Hive
- Migrating Data from MySQL to OBS
- Migrating Data from MySQL to DWS
- Migrating an Entire MySQL Database to RDS
- Migrating Data from Oracle to CSS
- Migrating Data from Oracle to DWS
- Migrating Data from OBS to CSS
- Migrating Data from OBS to DLI
- Migrating Data from MRS HDFS to OBS
- Migrating the Entire Elasticsearch Database to CSS
-
Advanced Data Migration Guidance
- Incremental Migration
- Using Macro Variables of Date and Time
- Migration in Transaction Mode
- Encryption and Decryption During File Migration
- MD5 Verification
- Configuring Field Converters
- Migrating Files with Specified Names
- Regular Expressions for Separating Semi-structured Text
- Recording the Time When Data Is Written to the Database
- File Formats
- Scheduling a CDM Job by Transferring Parameters Using DataArts Factory
- Enabling Incremental Data Migration Through DataArts Factory
- Creating Table Migration Jobs in Batches Using CDM Nodes
- Simplified Migration of Trade Data to the Cloud and Analysis
- Migration of IoV Big Data to the Lake Without Loss
-
Tutorials
- Performance White Paper
- Security White Paper
-
API Reference
- Before You Start
- API Overview
- Calling APIs
- Application Example
-
API
-
Cluster Management
- Querying Cluster Details
- Deleting a Cluster
- Querying All AZs
- Querying Supported Versions
- Querying Version Specifications
- Querying Details About a Flavor
- Querying the Enterprise Project IDs of All Clusters
- Querying the Enterprise Project ID of a Specified Cluster
- Query a Specified Instance in a Cluster
- Modifying a Cluster
- Restarting a Cluster
- Starting a Cluster
- Stopping a Cluster (To Be Taken Offline)
- Creating a Cluster
- Querying the Cluster List
- Job Management
- Link Management
-
Cluster Management
- Public Data Structures
- Permissions Policies and Supported Actions
- Appendix
-
FAQs
-
General
- What Are the Differences Between CDM and Other Data Migration Services?
- What Are the Advantages of CDM?
- What Are the Security Protection Mechanisms of CDM?
- How Do I Reduce the Cost of Using CDM?
- Will I Be Billed If My CDM Cluster Does Not Use the Data Transmission Function?
- Why Am I Billed Pay per Use When I Have Purchased a Yearly/Monthly CDM Incremental Package?
- How Do I Check the Remaining Validity Period of a Package?
- Will My Data Be Retained If My Package Expires or My Pay-per-Use Resources Are in Arrears?
- Can CDM Be Shared by Different Tenants?
- Can I Upgrade a CDM Cluster?
- How Is the Migration Performance of CDM?
- What Is the Number of Concurrent Jobs for Different CDM Cluster Versions?
- Can I Stop a CDM Cluster?
-
Functions
- Does CDM Support Incremental Data Migration?
- Does CDM Support Field Conversion?
- What Component Versions Are Recommended for Migrating Hadoop Data Sources?
- What Data Formats Are Supported When the Data Source Is Hive?
- Can I Synchronize Jobs to Other Clusters?
- Can I Create Jobs in Batches?
- Can I Schedule Jobs in Batches?
- How Do I Back Up CDM Jobs?
- What Should I Do If Only Some Nodes in a HANA Cluster Can Communicate with the CDM Cluster?
- How Do I Use Java to Invoke CDM RESTful APIs to Create Data Migration Jobs?
- How Do I Connect the On-Premises Intranet or Third-Party Private Network to CDM?
- Does CDM Support Parameters or Variables?
- How Do I Set the Number of Concurrent Extractors for a CDM Migration Job?
- Does CDM Support Real-Time Migration of Dynamic Data?
- Can I Stop CDM Clusters?
- How Do I Obtain the Current Time Using an Expression?
- What Is the Time Format for the Where Clause Parameters for Creating a Migration Job?
- Can CDM Migrate Field Comments from a Source Table to a Destination Table?
-
Troubleshooting
- What Should I Do If the Log Prompts that the Date Format Fails to Be Parsed?
- What Can I Do If the Map Field Tab Page Cannot Display All Columns?
- How Do I Select Distribution Columns When Using CDM to Migrate Data to GaussDB(DWS)?
- What Do I Do If the Error Message "value too long for type character varying" Is Displayed When I Migrate Data to DWS?
- What Can I Do If Error Message "Unable to execute the SQL statement" Is Displayed When I Import Data from OBS to SQL Server?
- What Should I Do If the Cluster List Is Empty, I Have No Access Permission, or My Operation Is Denied?
- Why Is Error ORA-01555 Reported During Migration from Oracle to DWS?
- What Should I Do If the MongoDB Connection Migration Fails?
- What Should I Do If a Hive Migration Job Is Suspended for a Long Period of Time?
- What Should I Do If an Error Is Reported Because the Field Type Mapping Does Not Match During Data Migration Using CDM?
- What Should I Do If a JDBC Connection Timeout Error Is Reported During MySQL Migration?
- What Should I Do If a CDM Migration Job Fails After a Link from Hive to GaussDB(DWS) Is Created?
- How Do I Use CDM to Export MySQL Data to an SQL File and Upload the File to an OBS Bucket?
- What Should I Do If CDM Fails to Migrate Data from OBS to DLI?
- What Should I Do If Error "Configuration Item [linkConfig.createBackendLinks] Does Not Exist" or "Configuration Item [throttlingConfig.concurrentSubJobs] Does Not Exist" Is Reported?
- What Should I Do If Message "CORE_0031:Connect time out. (Cdm.0523)" Is Displayed During the Creation of an MRS Hive Link?
- What Should I Do If Message "CDM Does Not Support Auto Creation of an Empty Table with No Column" Is Displayed When I Enable Auto Table Creation?
- What Should I Do If I Cannot Obtain the Schema Name When Creating an Oracle Relational Database Migration Job?
- What Should I Do If invalid input syntax for integer: "true" Is Displayed During MySQL Database Migration?
- What Should I Do If the Migration Source Is Oracle and Error Message "snapshot too old" Is Displayed?
- What Should I Do If Error "Identifier name is too long" Is Reported During Entire DB Migration to Hive?
- What Should I Do If Data Is Lost During Migration to DLI?
- What Should I Do If the Oracle Link Connectivity Test Is Successful on the Link Creation Page but Fails on the Links Page?
- What Should I Do If Destination Fields Are Not Displayed When Auto Table Creation Is Enabled in the Destination Job Configuration?
- What Should I Do If a Job Exported from a Cluster Fails to Be Imported to Another Cluster?
- What Should I Do If an Error Message Is Displayed Indicating that the Block Is Missing During HDFS File Migration?
- What Should I Do If the CDM Job Management Page Cannot Be Accessed and a Message Is Displayed Indicating that the Network or Server Cannot Be Accessed?
- What Should I Do If a CDM Cluster of Version 2.8.6 Fails to Migrate Data from OBS to DLI?
- What Should I Do If Error Message "Read timed out" Is Displayed During DWS Data Migration?
- What Should I Do If No Database or Table Information Can Be Obtained Through a Hive Link?
- What Should I Do If Error "get filesystem" Is Reported During the Creation of a FusionInsight HDFS Link?
- What Should I Do If Error "Invoke DLI service api failed" Is Reported When the Data Migration from MySQL to DLI Is About to Complete?
- What Should I Do If a MongoDB Field Fails to Be Migrated to the Destination?
- What Should I Do If a Field Is Escaped and Contains a Backslash (\) During the Migration of a DLI Foreign Table (OBS File) to DWS?
- What Should I Do If "Error occurs during loader run" Is Reported During Migration from PostgreSQL to Hive?
- What Should I Do If Error Message "Lost connection to MySQL server during query" Is Displayed During Migration from MySQL to DWS?
- What Should I Do If Error Message "For input string: "false" Is Displayed During Field Type Conversion During MySQL-to-DLI Migration?
- What Should I Do If an Error Occurs During the Migration of TINYINT Data from MySQL to DWS?
- What Should I Do If the Data Volume Is Inconsistent Before and After Data Migration?
- What Should I Do If an Error Is Reported Indicating an Incorrect Username or Password During Link Creation but They Are Correct Indeed?
- What Should I Do If a Message Is Displayed Indicating that the Fields in the Lower Camel Case Do Not Exist During Data Migration from a Database to OBS?
- What Should I Do If Error "invalid utf-8 character string" Is Reported When CSV Data Is Inserted into the MySQL Database?
- What Should I Do If a Scheduled Job Fails and Link Connectivity Is Abnormal?
- What Should I Do If CSV Data Fails to Be Inserted into a MySQL Database?
- What Should I Do If Error "timeout waiting for connection from pool" Is Reported During ES Writing?
- Why Is Error ORA-01555 Reported During Migration from Oracle to DWS?
- What Should I Do If the FTP Connectivity Test Fails and an Internal Server Error Is Reported?
- What Should I Do If All Users Except User root Cannot Access RDS for MySQL?
-
General
- General Reference
Copied.
Using Macro Variables of Date and Time
- Source directory or file
- Source table name
- Directory filter and file filter of the wildcard type
- Start time and end time of the time filter type
- Partition filter criteria and where clause
- Write directory
- Destination table name
You can use the ${} macro variable definition identifier to define the macros of the time type. currently, dateformat and timestamp are supported.
By using the macro variables of date and time and scheduled job, you can implement incremental synchronization of databases and files.
If you have configured a macro variable of date and time and schedule a CDM job through DataArts Studio DataArts Factory, the system replaces the macro variable of date and time with (Planned start time of the data development job – Offset) rather than (Actual start time of the CDM job – Offset).
dateformat
dateformat supports two types of parameters:
- dateformat(format)
format indicates the date and time format. For details about the format definition, see the definition in java.text.SimpleDateFormat.java.
For example, if the current date is 2017-10-16 09:00:00, yyyy-MM-dd HH:mm:ss indicates 2017-10-16 09:00:00.
- dateformat(format, dateOffset, dateType)
- format indicates the format of the returned date.
- dateOffset indicates the date offset.
- dateType indicates the type of the date offset.
Currently, dateType supports SECOND, MINUTE, HOUR, MONTH, YEAR, and DAY.
NOTE:
Pay attention to the following special scenarios of MONTH and YEAR:
- If the date does not exist after the offset, the latest date of the month in the calendar is used.
- These two offset types cannot be used for the start time and end time in the Time Filter parameter of the source and destination jobs.
For example, if the current date is 2023-03-01 09:00:00, then:
- dateformat(yyyy-MM-dd HH:mm:ss, -1, YEAR) indicates the year before the current time, that is, 2022-03-01 09:00:00.
- dateformat(yyyy-MM-dd HH:mm:ss, -3, MONTH) indicates three months before the current time, that is, 2022-12-01 09:00:00.
- dateformat(yyyy-MM-dd HH:mm:ss, -1, DAY) indicates the day before the current time, that is, 2023-02-28 09:00:00.
- dateformat(yyyy-MM-dd HH:mm:ss, -1, HOUR) indicates one hour before the current time, that is, 2023-03-01 08:00:00.
- dateformat(yyyy-MM-dd HH:mm:ss, -1, MINUTE) indicates one minute before the current time, that is, 2023-03-01 08:59:00.
- dateformat(yyyy-MM-dd HH:mm:ss, -1, SECOND) indicates one second before the current time, that is, 2023-03-01 08:59:59.
timestamp
timestamp supports two types of parameters:
- timestamp()
Indicates the returned timestamp of the current time, that is, the number of milliseconds that have elapsed since 00:00:00 on January 1, 1970 (1970-01-01 00:00:00 GMT). For example, 1508078516286.
- timestamp(dateOffset, dateType)
Indicates the timestamp returned after time offset. dateOffset and dateType indicate the date offset and the offset type, respectively.
For example, if the current date is 2017-10-16 09:00:00, timestamp(-10, MINUTE) indicates that the timestamp generated 10 minutes before the current time point is returned, that is, 1508115000000.
Macro Variable Definition of Time and Date
Suppose that the current time is 2017-10-16 09:00:00, then Table 1 describes the macro variable definitions 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 |
${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 |
Time and Date Macro Variables of Paths and Table Names
- Table Name under Source Link Configuration is set to CDM_/${dateformat(yyyy-MM-dd)}.
- Write Directory under Destination Link Configuration is set to /opt/ttxx/${timestamp()}.
After the macro definition conversion, this job indicates that data in table SQOOP.CDM_20171016 in the Oracle database is migrated to the /opt/ttxx/1508115701746 directory of the HDFS server.
Currently, a table name or path name can contain multiple macro variables. For example, /opt/ttxx/${dateformat(yyyy-MM-dd)}/${timestamp()} is converted to /opt/ttxx/2017-10-16/1508115701746.
Time and Date Macro Variables in the Where Clause
Figure 2 uses table SQOOP.CDM_20171016 as an example. The table contains column DS, which indicates the time.
Suppose that the current date is 2017-10-16 and you want to export data generated the day before the current day (DS = 2017-10-15), then you can set the value of Where Clause to DS='${dateformat(yyyy-MM-dd,-1,DAY)}' when creating a job. In this way, you can export all data that complies with the DS = 2017-10-15 condition.
Implementing Incremental Synchronization by Configuring the Macro Variables of Date and Time and Scheduled Jobs
Two simple application scenarios are as follows:
- The database table contains column DS that indicates the time, the value type of the column is varchar(30), and the inserted time format is similar to 2017-xx-xx.
In a scheduled job, the cycle is one day, and the scheduled job is executed at 00:00:00 every day. Set the value of Where Clause to DS='${dateformat(yyyy-MM-dd,-1,DAY)}', and then data generated in the previous day will be exported at 00:00:00 every day.
- The database table contains column time that indicates the time, the type is Number, and the inserted time format is timestamp.
In a scheduled job, the cycle is one day, and the scheduled job is executed at 00:00:00 every day. Set the value of Where Clause to time between ${timestamp(-1,DAY)} and ${timestamp()}, and then data generated on the previous day will be exported at 00:00:00 every day.
Configuration principles of other application scenarios are the same.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot