After you create a MaxCompute project, you must enter the project to perform subsequent operations, such as development, analysis, and O&M. This topic describes common operations on projects, such as enter or view a project, and how to configure or view its project-level properties.

The following table describes the common statements that are used for project operations.
Operation Description Role Platform
Enter a project Enters a project on which you have access permissions. Users who have project access permissions You must execute the statements described in this topic on the MaxCompute client.
View the properties of a project Views the properties of a project. Project owner
Set project properties Sets the properties of a project. Project owner
View account systems of a project Queries the information of the account system supported by a project. Project owner
Add the RAM account system Adds the Resource Access Management (RAM) account system for a project. Project owner
Remove the RAM account system Removes the RAM account system of a project. Project owner

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.

Enter a project

Enters a specified project on which you have access permissions. After you enter the project, you can manage all objects in the project.

  • Syntax
    -- Enter a project. 
    use <project_name>;
  • Parameter

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

  • Examples
    • Example 1: Enter a specified project and access objects in the project.
      -- The current project is my_project, and the project that you want to enter is my_project_test. You have access permissions on the my_project_test project. 
      odps@ my_project>use my_project_test;
      -- After you enter 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 automatically 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 project object that you want to access and specify the name of the project whose object you want to access.
      -- 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;

View the properties of a project

Views the project-level properties of a project. MaxCompute also allows you to view the session-level properties of a project. For more information, see show flags.

  • Syntax
    setproject;
  • Properties
    The following table describes common project properties.
    Property (KEY) Description Valid value (VALUE)
    odps.sql.allow.fullscan Specifies whether to enable a full table scan on a project. A full table scan occupies a large number of resources, which reduces data processing efficiency. Therefore, we recommend that you do not enable this feature.
    • True: A full table scan is enabled.
    • False: A full table scan is disabled.
    odps.table.lifecycle Specifies whether to configure a lifecycle for tables in a project.
    • Optional: The lifecycle clause is optional in a table creation statement. If you do not configure a lifecycle for a table, the table does not expire.
    • Mandatory: The lifecycle clause is required in a table creation statement.
    • Inherit: If you do not configure a lifecycle for a table when you create the table, the value of odps.table.lifecycle.value is used as the lifecycle of the table.
    odps.table.lifecycle.value The lifecycle of a table. Unit: days. Valid values: 1 to 37231. Default value: 37231.
    odps.security.ip.whitelist A whitelist of IP addresses that are authorized to access the project over the classic network. For more information, see Configure IP address whitelists. A list of IP addresses that are separated by commas (,).
    odps.security.vpc.whitelist A whitelist of IP addresses that are authorized to access the project over a specified virtual private cloud (VPC). For more information, see Configure IP address whitelists. RegionID_VPCID[IP Address].
    READ_TABLE_MAX_ROW The maximum number of data records that can be returned by a SELECT statement. Valid values: 1 to 10000. Default value: 10000.
    odps.sql.type.system.odps2 Specifies whether to enable the MaxCompute V2.0 data type edition. For more information about the MaxCompute V2.0 data type edition, see MaxCompute V2.0 data type edition.
    • True: The MaxCompute V2.0 data type edition is enabled.
    • False: The MaxCompute V2.0 data type edition is disabled.
    odps.sql.hive.compatible Specifies whether to enable the Hive-compatible data type edition. MaxCompute supports Hive syntax, such as inputRecordReader, outputRecordReader, and Serde, only after the Hive-compatible data type edition is enabled. For more information about the Hive-compatible data type edition, see Hive-compatible data type edition.
    • True: The Hive-compatible data type edition is enabled.
    • False: The Hive-compatible data type edition is disabled.
    odps.sql.decimal.odps2 Specifies whether to enable DECIMAL(precision,scale) in the MaxCompute V2.0 data type edition. For more information, see MaxCompute V2.0 data type edition.
    • True: DECIMAL(precision,scale) in the MaxCompute V2.0 data type edition is enabled.
    • False: DECIMAL(precision,scale) in the MaxCompute V2.0 data type edition is disabled.
    odps.sql.metering.value.max The upper limit on resources consumed by an SQL statement. For more information, see Consumption control. N/A
    odps.sql.timezone The time zone of the MaxCompute project that you accessed. For more information about the time zone, see Time zone configuration operations. N/A
    odps.sql.unstructured.oss.commit.mode Specifies whether to enable the multipart upload feature of Object Storage Service (OSS) to write data to OSS external tables. For more information, see Export data to OSS.
    • True: The multipart upload feature is enabled.
    • False: The multipart upload feature is disabled.
    odps.sql.groupby.orderby.position.alias Specifies whether to use integer constants in the GROUP BY and ORDER BY clauses as column IDs in SELECT statements.
    Note If this property is set to True for an existing project, data parsing or other operations may fail to be performed. Make sure that the original logic can be correctly executed for the existing project when you set this property to True. Otherwise, set the session-level property.
    • True: Integer constants in the GROUP BY and ORDER BY clauses can be used as column IDs in SELECT statements.
    • False: Integer constants in the GROUP BY and ORDER BY clauses cannot be used as column IDs in SELECT statements.

Set project properties

Sets the project-level properties of a project. This statement takes effect within 5 minutes. Check the result 5 minutes after the statement is successfully executed. MaxCompute also allows you to set session-level properties for a project. For more information, see set.

  • Syntax
    setproject <KEY>=<VALUE>;
  • Parameters
    • KEY: the name of the property.
    • VALUE: the value of the property. For more information about properties, see View project properties.
  • Example
    Enable a full table scan for a project.
    setproject odps.sql.allow.fullscan=true;

View account systems of a project

Views the information of the account systems supported by a project. The account systems include the Alibaba Cloud account system and RAM account system. Syntax:
list accountproviders;
Note By default, MaxCompute identifies only the Alibaba Cloud account system. It cannot identify the RAM account system.

Add the RAM account system

Adds the RAM account system for a project. Syntax:
add accountprovider ram;

Remove the RAM account system

Removes the RAM account system of a project. Syntax:
remove accountprovider ram;