Generally, you must create tables during data development to store the results of data synchronization and data processing. The Data Management module of Alibaba Cloud DTplus platform provides two ways to create a table:
- Visualized table creation
- Statement-based table creation
Compared with a script-based table creation by using the Data Development module, tables created by using the Data Management module can be classified into different business categories. The classification can facilitate metadata management for numerous businesses in the organization.
Real-name registration for cloud accounts to generate the access ID and AccessKey. The cloud account used to create tables is the current logon account and must have an access ID and AccessKey to send the table creation request to MaxCompute. Therefore, this cloud account must complete the real-name registration to generate the access ID and AccessKey.
Log on to Alibaba Cloud official website using the cloud account.
Go to My Center, and click accesskeys in the upper right corner to enter the new page, as shown in the following figure:
Click Create Access Key to apply for an access ID and AccessKey successfully.
Grant table creation permission to cloud accounts. You must grant permissions to the cloud account to create tables. MaxCompute project owners can directly run the authorization statement to authorize the permissions.
use projectname; --Open the project space
add user aliyun$Cloud account; --Add a user
grant CreateInstance,CreateTable,List ON PROJECT projectname TO aliyun$Cloud account; --Grant permissions to the user
Note: The tables are created using the current logon cloud account, so the table owner is the current logon account.
Log on to DTplus console and click management console as a developer. Click Enter the work area after the corresponding project.
Click Data Management in the upper navigation pane and navigate to Manage Data Tables page.
Click Create table.
Complete the configurations of the Basic information steps in the Create table dialog box.
Project name: The list shows the MaxCompute project space that the current logon user is in.
Table name: A table name consists of letters, numbers, and underscores.
Alias: The Chinese name of the table.
Category: The category of the current table. Up to four levels of category are supported. For more information about the configuration of category navigation, see Manage configuration.
Description: A brief description of the current table.
Lifecycle: The Lifecycle function of MaxCompute. Enter a number to represent the number of days. Data in the table (or partition) that is not updated for a specified number of days, gets cleared. Five options are available, including 1 day, 7 days, 32 days, Permanent, and User-defined.
Click Next step.
Complete the configurations of the Field and partition information step in the Create table dialog box.
Complete the field information settings.
Set the partition.
Field’s English name: The English name of a field, which consists of letters, numbers, and underscores (_).
Field type: MaxCompute data type (string, bigint, double, datetime, or boolean).
Description: The detailed description of a field.
Operation: The options include Move Up, Move Down, and Delete.
Set a partition: If Yes is selected, configure the partition key information. The string and bigint types are supported.
After a newly created table is submitted, the system automatically goes back to the Manage Data Tables page. Click My managed tables to view the newly created table.
Log on to DTplus console. Select DataWorks from the left-side navigation pane and click management console as a developer, and click Enter the work area in the Actions column of the corresponding project.
Click Data Management in the upper menu and go to the Manage Data Tables page.
Click Create table.
Click DDL table creation.
Enter the MaxCompute SQL statements of table creation as follows:
create table if not exists table2
id string comment‘User ID’,
name string comment‘Username’
) partitioned by(dt string)
Click Submit. The Basic information step appears.
Except Alias, Category, and Lifecycle, all the other configurations in the Basic information step are automatically filled. You must edit and provide the Chinese names and the security levels of fields in the Field and partition information step.
Complete the configurations in the Basic information step of the newly created table.
Click Next step.
After the newly created table is submitted, the system automatically goes back to the Manage Data Tables page. To view the newly created table, click My managed tables .