All Products
Search
Document Center

MaxCompute:USE

Last Updated:Jun 07, 2023

Goes to a specific project on which you have access permissions. After you go to the project, you can manage all objects in the project.

Limits

Execute the statements described in this topic on the MaxCompute client. This statement is a CMD statement and can only be executed on the MaxCompute client (odpscmd).

Usage notes

  • A project is not a workspace. To obtain a project name, log on to the MaxCompute console and view the name in the MaxCompute Project Name column on the Project management tab.

  • You cannot execute statements to create or delete projects in MaxCompute. For more information about how to create a project, see Create a MaxCompute project.

Syntax

-- Go to a project. 
use <project_name>;

Parameters

project_name: the name of the project to which you want to go. If the project does not exist or you do not have access permissions on the project, an error is returned.

Examples

  • Example 1: Go to a specific project and access the objects in the project.
    -- The current project is my_project, and the project that you want to go to is my_project_test. You have access permissions on the my_project_test project. 
    odps@ my_project>use my_project_test;
    -- After you go to the my_project_test project, you can perform other operations. For example, query the test_src table in the my_project_test project. 
    odps@ my_project_test>select * from test_src;
    MaxCompute searches for the test_src table in the my_project_test project. If the table exists, data in the table is returned. If the table does not exist, an error is returned.
  • Example 2: To access an object in a project from another project, grant permissions on the object and specify the name of the project to which the object belongs.
    -- Access the test_src table in the my_project2 project from the my_project_test project. 
    odps@ my_project_test>select * from my_project2.test_src;

Related statements