If you no longer need a set of sample data or a MaxCompute project, you can delete them to reduce resource consumption and storage fees. This topic describes how to delete a MaxCompute project or a table in a MaxCompute project.
Background information
You can decide whether to retain specific sample data and the MaxCompute project in which the data is used based on your needs:
If you retain the sample data for reference, you will be charged for data storage. For more information about storage pricing, see Storage pricing (pay-as-you-go).
If you do not want to retain the sample data but still need to use the MaxCompute project, you can delete the related tables. For more information about how to delete a table, see Delete a table.
NoteIf you accidentally drop a table, you can restore it if the backup and restoration feature is enabled for the project and the table is dropped within the backup data retention period specified for the project. For more information about the backup and restoration feature, see Backup.
If you do not want to retain the MaxCompute project, you can delete it. When you delete the project, all tables in the project are also deleted. For more information about how to delete a MaxCompute project, see Delete a MaxCompute project.
If you delete a MaxCompute project, the following situations occur:
If you immediately delete a project, data in all tables in the project is immediately deleted and cannot be restored.
All tasks submitted to the MaxCompute project fail because the project no longer exists.
If the MaxCompute project is associated with a DataWorks workspace, the DataWorks workspace becomes unusable and cannot be restored after the MaxCompute project is deleted. We recommend that you log on to the DataWorks console to disassociate the MaxCompute project from the DataWorks workspace before deleting the MaxCompute project.
NoteIf you are unsure whether the data needs to be retained, you can stop the project and check whether other services are affected. If other services are not affected, you can completely delete the data. Otherwise, you can manually restore the project. For more information about how to restore a project, see Change project status.
Delete a table
You can run the following command on the MaxCompute client to delete a table from a MaxCompute project:
drop table <table_name>;After you delete the table, you can run the following command to verify the deletion:
show tables;If no table information is returned, the table has been successfully deleted.
Delete a MaxCompute project
For more information about how to delete a MaxCompute project in the new MaxCompute console, see Project management. This topic describes how to delete a MaxCompute project in the old MaxCompute console. You can log on to the MaxCompute console using your Alibaba Cloud account or as a RAM user that is assigned the Super_Administrator role and delete the MaxCompute project that you no longer use. For more information about the Super_Administrator role, see Super_Administrator. The procedure is as follows:
To delete a project using a RAM user or RAM role, make sure that the RAM user or RAM role is granted the following permissions:
The permissions of the administrator of the associated DataWorks workspace. These permissions are required because you must disassociate a project from the associated DataWorks workspace before you delete the project. For more information about how to view the administrator of the associated DataWorks workspace, see Go to Management Hub.
The
maxcompute:DeleteProjectpermission. This permission must be granted to the RAM user or RAM role in the Resource Access Management (RAM) console. For more information, see Create a custom policy on the JSON tab. The following sample code shows the document of the policy:{ "Version": "1", "Statement": [ { "Effect": "Allow", "Action":"maxcompute:DeleteProject", "Resource": "*" } ] }
Log on to the MaxCompute console. In the top navigation bar, select a region.
On the Projects page, click Delete in the Actions column of the target MaxCompute project.
In the Delete Project dialog box, confirm and select Are You Sure You Want To Continue With The Deletion Of The MaxCompute Project?, and click OK to delete the MaxCompute project.
The only deletion type that is currently supported for MaxCompute projects is Immediate And Permanent Deletion. After a project is deleted, you can immediately create another project with the same name.NoteIf the MaxCompute project is associated with a DataWorks workspace, you must first disassociate the project from the workspace before deleting it. Otherwise, directly deleting the MaxCompute project will cause the associated DataWorks workspace to become unusable and unrecoverable. For more information about how to disassociate a project, see Manage workspaces.
What to do next
You have completed the Quick Start guide for the MaxCompute client. For more information about how to use MaxCompute, see Additional information.