All Products
Search
Document Center

MaxCompute:Delete a table or a MaxCompute project

Last Updated:Nov 08, 2024

If you no longer need to use a set of sample data or a MaxCompute project, you can delete the data or MaxCompute project 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 determine whether to retain a specific set of sample data and the MaxCompute project in which the sample data is used based on your business requirements.

  • If you retain the sample data for reference, you are charged for the storage of the data. 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 in which the sample data is used, you can delete the related tables. For more information about how to delete a table, see Delete tables.

    Note

    If you accidentally drop a table, you can restore the table 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 and restoration.

  • If you do not want to retain the MaxCompute project, you can delete the MaxCompute project. If 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 does not exist.

    • If the MaxCompute project is associated with a DataWorks workspace, the DataWorks workspace cannot be used 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 you delete the MaxCompute project.

    Note

    If you are not sure 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 tables

Run the following commands on the MaxCompute client to delete the specified tables from a MaxCompute project:

drop table <table_name>;

After you delete the tables, you can run the following command to check the result:

show tables;

If no table information is returned, the tables are deleted.

Delete a MaxCompute project

For more information about how to delete a MaxCompute project in the new MaxCompute console, see Manage projects in the new MaxCompute console. This topic describes how to delete a MaxCompute project in the old MaxCompute console. You can log on to the old MaxCompute console by 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. This section describes how to delete a MaxCompute project.

Note

To delete a project by 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 SettingCenter page.

  • The DeleteProject permission. 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": "*"
        }
      ]
    }
  1. Log on to the MaxCompute console. In the top navigation bar, select a region.

  2. In the left-side navigation pane, click Projects, find your project on the Projects page, click Delete in the Actions column.

  3. In the Delete Project dialog box, select a deletion method and click Delete.

    image

    You can use one of the following methods to delete a MaxCompute project:

    • Logically Delete and Project Restoration Allowed Within 15 Days: If you use this method to delete a project, the project becomes unavailable after it is deleted. To restore the project, find the project and click Restore in the Actions column on the Project management tab within 15 days. After 15 days, the project is permanently deleted and cannot be restored.

    • Immediately Delete and Project Restoration Not Allowed: If you use this method to delete a project, the project is permanently deleted and cannot be restored. In addition, you can immediately create a project with the same name.

    Note
    • When you delete a MaxCompute project that is associated with a DataWorks workspace, you are prompted to disassociate the MaxCompute project from the DataWorks workspace in the Compute Engine Information section of the Configuration page. The DataWorks workspace that is associated with the MaxCompute project is retained when you delete the MaxCompute project.

    • When you create a MaxCompute project, a DataWorks workspace that has the same name as the MaxCompute project is automatically created. If you use the Immediately Delete and Project Restoration Not Allowed method to delete the MaxCompute project and want to create a MaxCompute project with the same name, you must delete the DataWorks workspace before you can create the MaxCompute project. Otherwise, the MaxCompute project fails to be created.

What to do next

For more information about how to use MaxCompute, see Additional information.