After you create a MaxCompute project, you must go to 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, or 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
Set 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 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.

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

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

Set project properties

Sets the project-level properties of a project. This statement takes effect within 5 minutes after 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 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.
  • Examples
    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;