The MaxCompute console provides the data upload feature. This feature allows you to upload data from local files or Alibaba Cloud Object Storage Service (OSS) to MaxCompute in offline mode for analysis, processing, and management.
Limits
You can upload data only from a local file or Alibaba Cloud OSS.
Local file: You can upload data from a CSV or XLSX file.
CSV file: A maximum of 5 GB of data can be uploaded.
XLSX file: A maximum of 100 MB of data can be uploaded.
Alibaba Cloud OSS: You can upload data only from a CSV file. A maximum of 5 GB of data can be uploaded. The bucket in which the data is stored must be in the same region as the current MaxCompute project.
You cannot upload data to an existing table or new table that contains a custom schema. For more information about custom schemas, see Schema-related operations.
Prerequisites
A MaxCompute project is created to store the uploaded data. You must have the related data permissions. For example:
Upload data to an existing table: You must have the permissions to write data to the table.
Upload to a new table: You must have the permissions to create a table in the project.
For more information about how to create a MaxCompute project, see Manage projects. For more information about how to grant permissions, see Permission overview.
When you upload data from OSS, make sure that the following conditions are met:
OSS is activated and a bucket is created. The data that you want to upload is stored in the bucket. For more information, see Create a bucket and Upload objects.
The Alibaba Cloud account that is used to upload data has the permissions to access the bucket. For more information, see Access control.
Procedure
Log on to the MaxCompute console and select a region in the upper-left corner.
In the left-side navigation pane, choose Data Transfer > Data Upload. The Data Upload page appears.
On the Data Upload page, configure the parameters described in Table 1. Parameters for uploading required data.
Table 1. Parameters for uploading required data
Section
Parameter
Description
Data Source
Local File
Upload data from a local file.
You can select only a CSV file or XLSX file to upload data.
CSV file: You can upload a maximum of 5 GB of data. The data in the file is separated by commas (,).
XLSX file: You can upload a maximum of 100 MB of data. By default, only the data in the first sheet of the XLSX file is uploaded. If the file contains multiple sheets, the data in other sheets cannot be uploaded.
Alibaba Cloud OSS
Upload data from OSS.
You can select only a CSV file in a bucket in the current region. You can upload a maximum of 5 GB of data at a time. If no bucket is available, you must create a bucket. For more information, see Create a bucket.
NoteIf the size of data that you want to upload exceeds 5 GB, you must split the data for the upload. Otherwise, the upload fails.
Specify Data to Be Uploaded
Select Bucket
If you set Data Source to Alibaba Cloud OSS, select the path of the bucket in which the desired file is stored.
Select File
Select the CSV file or XLSX file that you want to upload.
Whether To Remove Dirty Data
Specifies whether to remove the data that is not of the same type as the data in the related column of the destination MaxCompute table from the file that you want to upload.
NoteFor example, if data in a column of the file that you want to upload is of the STRING type and contains letters, but data in the related column of the destination table is of the BIGINT type, the data in the column of the STRING type is considered as dirty data. If you set Whether To Remove Dirty Data to Yes, the dirty data is not uploaded.
Yes: removes the data that is not of the same type as the data in the related column of the destination table from the file that you want to upload.
No: uploads full data of the file.
Configure Destination Table
MaxCompute Project Name
Select the MaxCompute project in which you want to store data.
Destination Table
Specifies whether to upload data to an existing table or a new table based on your business requirements.
Existing Table: For more information about the parameter configuration, see Table 2. Parameters for uploading data to an existing table.
Create Table: For more information about the parameter configuration, see Table 3. Parameters for uploading data to a new table.
Table 2. Parameters for uploading data to an existing table
Parameter
Description
Select Destination Table
Select the MaxCompute table to which you want to store the uploaded data from the drop-down list. You can enter a keyword to search for the desired MaxCompute table.
Upload Method
Select a method to upload data to the destination table based on the configured mappings between the columns of the source file and the fields in the destination table.
Clear Table Data First: overwrites the data in the related fields of the destination table.
Append: appends the data that you want to upload to the related fields of the destination table.
NoteFor more information about the configuration of the mappings, see Preview the data that you want to upload and specify fields in the destination table.
Table 3. Parameters for uploading data to a new table
Parameter
Description
Table Name
Enter a custom name of the table.
Table Type
Select Non-partitioned Table or Partitioned Table based on your business requirements. If you select Partitioned Table, you must specify partition fields and values.
Lifecycle
Specify the validity period of the table. The table may become unavailable after it expires. For more information about the lifecycle of a table, see Lifecycle and Lifecycle management operations.
Preview the data that you want to upload and specify fields in the destination table.
After you select a file that you want to upload and a destination table in which you want to store the data, you can preview the data details and configure the mappings between the columns of the file and the fields in the destination table. After the mappings are configured, the data can be uploaded. The following table describes the parameters that need to be configured.
NoteOnly the first 20 data records can be previewed.
Section
Parameter
Description
Preview Data of Uploaded File
File Encoding Format
If the file contains garbled code, you can change the file encoding format. Valid values: UTF-8, GB18030, and Big5.
Mapping by Column Name
Import data in the file that you want to upload to the destination table based on the mappings between column names.
Mapping by Order
Import data in the file that you want to upload to the destination table in the order of fields.
Ignore First Row
Specifies whether to upload the first row of the file that you want to upload to the destination table. In most cases, the first row of a file contains column names.
If you select Ignore First Row, the first row of the file is not uploaded to the destination table.
If you do not select Ignore First Row, the first row of the file is uploaded to the destination table.
Click Upload data to submit the upload.
ImportantIf no mapping exists between the data to be uploaded and the fields in the destination table, the data is dimmed and not uploaded.
One-to-more mappings are not supported.
The field name and field type must be configured. Otherwise, the data cannot be uploaded.
View upload records
If you upload a large amount of data, a long period of time is required to upload the data. You can click View Upload records in the upper-right corner of the Data Upload page to view the details of the uploaded data.
On the Data Upload record page, you can also view the records that are generated when you use DataWorks to upload data.
What to do next
After the data is uploaded, you can use a connection tool to query the data in the destination MaxCompute table. For more information about connection tools, see Select a connection tool.