All Products
Search
Document Center

MaxCompute:Project operations

Last Updated:Dec 17, 2024

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 going to a project, viewing a project, configuring project-level properties for a project, and viewing the project-level properties of a project.

The following table describes common project operations.

Operation

Description

Role

Platform

Go to a project

Goes to a project on which you have access permissions.

Users who have project access permissions

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

Configure project properties

Sets the properties of a project.

Project owner

View the account systems of a project

Views the information of the account systems 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

Precautions

  • A project is not a workspace. To obtain a project name, log on to the MaxCompute console and select a region, then you can view the Project Name on the Projects page.

  • MaxCompute does not provide statements that are used to create and delete projects. For information about how to create a project, see Create a MaxCompute project.

Go to a project

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.

  • Syntax

    -- Go to a project. 
    USE <project_name>;
  • Parameter

    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 objects in the project.

      -- The current project is my_project, and the project to which you want to go 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, you can 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.

      • Sample code that can be used if the Schema feature is not enabled for MaxCompute:

        -- 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;
      • Sample code that can be used if the schema feature is enabled for MaxCompute:

        -- Access the test_src table in the my_project2 project from the my_project_test project. By default, the schema of the my_project2 project is named DEFAULT.
        odps@ my_project_test>SELECT * FROM my_project2.default.test_src;
        Note

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 the "SHOW FLAGS" section in SET operations.

  • 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 by default.

    odps.table.lifecycle.value

    The lifecycle of a table. Unit: days.

    1 to 37231. Default value: 37231.

    odps.security.ip.whitelist

    A whitelist of IP addresses that are authorized to access the project over the cloud product interconnection network. For more information, see Manage 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 specific virtual private cloud (VPC). For more information, see Manage 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.

    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 syntaxes, 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: The DECIMAL type in the MaxCompute V2.0 data type edition is enabled.

    • false: The DECIMAL type 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 time zones, 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 Write 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 parameter is set to true for an existing project, data parsing or other operations may fail to be performed. You must make sure that the original logic can be correctly executed for the existing project when you set this parameter to true. Otherwise, configure this parameter for sessions.

    • 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.

    odps.forbid.fetch.result.by.bearertoken

    Specifies whether to display the results of jobs on the Result tab of Logview. This parameter is used to protect data security.

    • true: The results of jobs are not displayed on the Result tab of Logview.

    • false: The results of jobs are displayed on the Result tab of Logview.

    odps.cupidhistory.inprogress.remain.days

    The retention duration of the logs that record the running history of a running Spark on MaxCompute job. Unit: days.

    1 to 7. Default value: 7.

    odps.cupidhistory.remain.days

    The retention duration of the logs that record the running history of a Spark on MaxCompute job that has finished running. Unit: days.

    1 to 3. Default value: 3.

    odps.ext.oss.orc.native

    Specifies whether to upgrade the Java library of the open source community to the C++ native library when a job in a project reads data from an external table to parse an ORC data file. The C++ native library can be used to parse later versions of ORC data files to significantly improve the parsing performance on open source data.

    • true: The C++ native library is used.

    • false: The Java library of the open source community is used.

    odps.ext.parquet.native

    Specifies whether to upgrade the Java library of the open source community to the C++ native library when a job in a project reads data from an external table to parse a Parquet data file. The C++ native library can be used to significantly improve the parsing performance on open source data. After you upgrade the Java library of the open source community to the C++ native library, the number of accesses to the data source may increase if a large number of small Parquet data files and a large number of data columns exist. In this case, when you create a table, you can configure the parquet.file.cache.size and parquet.io.buffer.size properties in the WITH SERDEPROPERTIES clause to increase the amount of data that can be cached for each access to the data source.

    • true: The C++ native library is used.

    • false: The Java library of the open source community is used.

    odps.security.enabledownloadprivilege

    Specifies whether to enable the download control feature. After you enable this feature, you can manage the permissions of users or roles to download tables or data of instances by using Tunnel commands. This helps improve the security of project data and prevents data leakage. For more information, see Download control.

    • true: The download control feature is enabled.

    • false: The download control feature is disabled.

    odps.security.ip.whitelist.services

    The Alibaba Cloud service whitelist of a MaxCompute project. If you add an Alibaba Cloud service such as DataHub or Simple Log Service to this whitelist, you no longer need to add the IP address of the service to the IP address whitelist of the MaxCompute project when you use the service to access the MaxCompute project later.

    The value of this parameter is in the service1,service2 format.

    Before you can add a service name to the whitelist, you must register the service name with MaxCompute.

    For example, if you want to add Simple Log Service to the whitelist, set this parameter to AliyunLogSLRService,AliyunLogDefaultService.

Configure project properties

Sets the project-level properties of a project. This statement takes effect within 5 minutes after it is executed. You can 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 the "SET" section in SET operations.

  • Syntax

    SETPROJECT <KEY>=<VALUE>;
  • Parameters

  • Example

    Enable a full table scan for a project.

    SETPROJECT odps.sql.allow.fullscan=true;

View the 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;