When configuring the objects to be migrated in a data migration task, you can specify conditions to filter data. Only data that meets the specified conditions is migrated to the destination database. This feature is applicable to scenarios such as regular data migration and table partitioning.

Procedure

  1. In the Configure Migration Types and Objects step, move the required objects to the Selected section, move the pointer over a database or table, and then click Edit.Select a table
  2. In the Edit Table dialog box that appears, enter an SQL condition in the Filter field.
    • Relational databases, such as MySQL and SQL Server.Enter an SQL condition
      Note
      • An SQL condition is a standard SQL WHERE statement. The following operators are supported: =, ! =, <, and >. Only data that meets the WHERE condition is migrated to the destination database. In this example, enter orderid>100.
      • You can use apostrophes (') in an SQL condition if necessary. For example, you can enter address in('hangzhou','shanghai').
    • Non-relational databases, such as MongoDB.
      Note You can specify a JSON-formatted condition. Only data that meets the specified condition is migrated to the destination database. In this example, enter {"id":{$gt:"52b64e55dc4449b7ba3d1183a0ea171b"}}. Only data with an ID greater than this value is migrated.
  3. Click Verify to check whether the syntax is valid.
    Note
    • If the syntax is valid, the Information message prompts that the validation is passed.
    • If the syntax is invalid, the Error message appears, you must modify the condition based on the instructions.
  4. Click OK.
  5. Configure other parameters that are required for the data migration task.