DataWorks allows you to upload local files in the specified formats, such as CSV files, to DataWorks and import the data to MaxCompute tables. This topic describes how to import data to a MaxCompute table.

Prerequisites

A MaxCompute table is created.

You can specify an existing MaxCompute table or create a MaxCompute table. For more information about how to create a MaxCompute table, see Create a MaxCompute table.

Limits

You can import only the data of your local files to a MaxCompute table.

Entry points for data import

You can import data to a MaxCompute table in the top toolbar of the Scheduled Workflow pane, in the MaxCompute folder of the Business Flow section, or in the Workspace Tables pane. The following figures show the entry points for data import.
  • Click the Import icon in the top toolbar of the Scheduled Workflow pane. Import data 1
  • In the Scheduled Workflow pane, find the required workflow, right-click the table to which you want to import data in the MaxCompute folder, and then select Import Data. Import data 2
  • In a workspace in standard mode, click Workspace Tables in the left-side navigation pane, right-click the table to which you want to import data, and then select Import Data. Import data 3

Import data

You can import only the data of your local files to a MaxCompute table.

  1. Perform one of the preceding operations to open the Data Import Wizard dialog box.
  2. In the Data Import Wizard dialog box, check the name of the table to which you want to import data. Then, specify the partition to which the data is imported and check whether the partitions exist. After that, click Next.
    Note If the table that you select is a non-partitioned table, click Next to skip this step.
    Configure partitions You can specify the partition to which the data is imported. After that, click Check to check whether the partition exists.
    • If the specified partition does not exist, the system creates a partition for subsequent operations and the data will be imported to the created partition.
    • If the specified partition exists, the data will be imported to this partition.
  3. Set the parameters, such as the File Format, Select File, and Select Delimiter parameters, based on your business requirements. Then, click Next.
    Data Import Wizard dialog boxThe following table describes the parameters.
    Parameter Description
    File Format The format of the file to be uploaded. Valid values: CSV and Custom Text File. If you set the parameter to Custom Text File, you can upload .txt, .csv, and .log files.
    Select File The file to be uploaded. You can click Browse and select the file to be uploaded as prompted.
    Select Delimiter The delimiter that is used to separate fields. Valid values: Comma (,), Tab, Semicolon (;), Space, |, #, and &.
    Note If you set the File Format parameter to Custom Text File, you can enter a character or string in the Select Delimiter field as the delimiter to separate fields.
    Original Character Set The encoding format of the file to be uploaded. Valid values: GBK, UTF-8, CP936, and ISO-8859.
    Import First Row The row from which the data is imported.
    First Row as Field Names Specifies whether the first row of the file to be imported is set as the header row.
    • If you select Yes, the first row of the file is not imported.
    • Otherwise, the first row of the file is imported.
  4. Specify the method used to match the fields between the uploaded file and the MaxCompute table. Then, click Import Data.
    You can set the Select a method for matching fields in the source and target tables parameter to By Location or By Name. Select a method for matching fields in the source and target tables
    After the operation is complete, a message appears to inform you that the data of the local file is imported to the MaxCompute table. You can view the imported data by running an ad hoc query. For more information, see Create an ad hoc query.