Updated on 2024-09-05 GMT+08:00

Importing Data

This section describes how to import data from your local PC or an OBS bucket for data backup and migration.

Precautions

  • Import data into a table for backup or migration. If you import a CSV or SQL file, the file must have the same data type as the target table.
  • Only one file that is no larger than 1 GB can be imported at a time.
  • Only data files in the CSV or SQL format can be imported. If the number of MySQL 8.0 instance tables exceeds 100,000 (more than 10,000 in MySQL 5.7 and 5.6), the CSV format cannot be used.
  • Binary fields such as BINARY, VARBINARY, TINYBLOB, BLOB, MEDIUMBLOB, and LONGBLOB are not supported.
  • The size of a single SQL statement to be imported must be less than 100 MB.
  • If a SQL file containing binary data is exported using the mysqldump tool, the file cannot be imported.

Procedure

  1. Log in to the DAS console.
  2. Click in the upper left corner and select a region and project.
  3. Click in the upper left corner, and under Databases, click Data Admin Service.
  4. In the navigation pane on the left, choose Development Tool.

    You can also click Go to Development Tool on the overview page.

  5. Locate the DB instance that you want to log in to and click Log In in the Operation column.
  6. On the top menu bar, choose Import and Export > Import.
  7. Click Create Task.

    Figure 1 Creating an import task
    Table 1 Parameter description

    Parameter

    Description

    Import Type

    Set Import Type to sql or CSV.

    File Source

    Import a file from your local PC or an OBS bucket.

    • Upload file

      If you select Upload file for File Source, you need to set Attachment Storage and upload the required file.

      To keep your data secure, provide your own OBS bucket to store the file you uploaded. In this way, DAS automatically connects to your OBS bucket for in-memory reading. No data is stored on DAS.

      Creating OBS buckets is free of charge, but saving files will incur certain costs.

      If you select Delete the uploaded file upon an import success, the file you uploaded will be automatically deleted from the OBS bucket after being imported to the destination database.

    • Choose from OBS

      If you select Choose from OBS for File Source, you need to select a file from the bucket.

      The file uploaded from an OBS bucket will not be deleted upon an import success.

    Database

    Select the database that you want to import the file to.

    Charset

    Select a charset as needed.

    Options

    If you select Ignore errors, that is, skip the step where the SQL statement fails to be executed, the system will skip any errors detected when SQL statements are being executed.

    If you select Delete the uploaded file upon an import success, the file you uploaded will be automatically deleted from the OBS bucket after being imported to the destination database. This option is only available to the files uploaded from your local PC.

    Remarks

    Enter remarks as required.

  8. After setting import parameters, click Create.

    Confirm the information again before you click OK because original data may be overwritten after data import.

  9. On the displayed page, view import progress in the task list.

    Click Details in the Operation column to view task details.