Run commands on the MaxCompute client to switch into a project, inspect its properties, and manage account systems. The following operations are covered:
| Operation | Required role |
|---|---|
| Switch to a project | Any user with access permissions on the project |
| View project properties | Project owner |
| Set project properties | Project owner |
| View account systems | Project owner |
| Add the RAM user system | Project owner |
| Remove the RAM user system | Project owner |
MaxCompute does not provide commands to create or delete projects. To create a project, see Create a MaxCompute project.
Get your project name
A MaxCompute project is separate from a DataWorks workspace and has its own name.
Log on to the MaxCompute console and select a region in the upper-left corner.MaxCompute console
In the navigation pane on the left, choose Manage Configurations > Projects.
On the Projects page, find the name of your MaxCompute project.
Switch to a project
USE <project_name>;Parameter
| Parameter | Description |
|---|---|
project_name | The name of the project to switch to. An error is returned if the project does not exist or you lack access permissions. |
After you switch to a project, unqualified object names in subsequent commands resolve to that project by default. The following table summarizes how object names resolve based on the current context:
| Context | How to reference an object |
|---|---|
| No project selected | Use the fully qualified name: <project>.<object> (schema disabled) or <project>.<schema>.<object> (schema enabled) |
| Project selected, schema feature disabled | Unqualified names resolve to the current project. To access another project's objects, use <project>.<object>. |
| Project selected, schema feature enabled | Unqualified names resolve to the current project and its default schema. To access another project's objects, use <project>.<schema>.<object>. |
Examples
Switch from my_project to my_project_test and query a table:
-- Switch to my_project_test (you have access permissions).
odps@ my_project>USE my_project_test;
-- Query the test_src table. MaxCompute searches in my_project_test automatically.
-- Returns data if the table exists, or an error if it does not.
odps@ my_project_test>SELECT * FROM test_src;Access an object in a different project without switching to it:
-- Schema feature disabled: reference the table with <project>.<table>.
odps@ my_project_test>SELECT * FROM my_project2.test_src;
-- Schema feature enabled: include the schema name.
-- The default schema of my_project2 is Default.
odps@ my_project_test>SELECT * FROM my_project2.default.test_src;To access objects in another project, you must have the required permissions on those objects. For details, see Project management and Schema operations.
View project properties
SETPROJECT;This command shows the current project-level property settings. Session-level properties (set with set) can override project-level values for the current session and are not reflected in this output. To view session-level properties, use show flags.
The following table lists the common project properties:
| Property | Description | Values | Default |
|---|---|---|---|
odps.sql.allow.fullscan | Controls whether full table scans are allowed. Full table scans consume significant computing resources. | true | false | — |
odps.table.lifecycle | Controls whether the LIFECYCLE clause is required when creating a table. | optional: The clause is optional; tables without a lifecycle never expire. mandatory: The clause is required. inherit: Tables without a lifecycle inherit the value of odps.table.lifecycle.value. | — |
odps.table.lifecycle.value | The default table lifecycle, in days. Applies when odps.table.lifecycle is set to inherit. | 1–37231 | 37231 |
odps.security.ip.whitelist | The IP address whitelist for Internet access to the project. For details, see Manage IP address whitelists. | Comma-separated IP addresses | — |
odps.security.vpc.whitelist | The IP address whitelist for Virtual Private Cloud (VPC) access to the project. For details, see Manage IP address whitelists. | VPC instance ID1,VPC instance ID2[IP address list] | — |
READ_TABLE_MAX_ROW | The maximum number of rows a SELECT statement can return. | 1–10000 | 10000 |
odps.sql.type.system.odps2 | Enables the MaxCompute V2.0 data types. For details, see Data type editions (V2.0). | true | false | — |
odps.sql.hive.compatible | Enables Hive-compatible mode, which adds support for Hive-specific syntax such as inputRecordReader, outputRecordReader, and Serde. For details, see Hive-compatible data type edition. | true | false | — |
odps.sql.decimal.odps2 | Enables the DECIMAL(precision,scale) data type from MaxCompute V2.0. For details, see Data type editions (V2.0). | true | false | — |
odps.sql.metering.value.max | The maximum computing consumption allowed for a single SQL statement. For details, see Consumption control. | — | — |
odps.sql.timezone | The time zone of the project. For details, see Time zone configurations. | — | — |
odps.sql.unstructured.oss.commit.mode | Enables multipart upload when writing data to OSS external tables. For details, see Write data to OSS. | true | false | — |
odps.sql.groupby.orderby.position.alias | Treats integer constants in GROUP BY and ORDER BY clauses as column ordinal positions in the SELECT list. | true | false | — |
odps.forbid.fetch.result.by.bearertoken | Prevents the Result tab in Logview from displaying job results, protecting data security. | true: results hidden | false: results shown | — |
odps.cupidhistory.inprogress.remain.days | Retention period for historical logs of running Spark on MaxCompute jobs, in days. | 1–7 | 7 |
odps.cupidhistory.remain.days | Retention period for historical logs of Spark on MaxCompute jobs, in days. | 1–3 | 3 |
odps.ext.oss.orc.native | Switches ORC file parsing for external tables from the original Java-based open-source implementation to a C++-based native implementation, which supports later ORC versions and improves parsing performance. | true: C++ implementation | false: Java implementation | — |
odps.ext.parquet.native | Switches Parquet file parsing for external tables from the original Java-based open-source implementation to a C++-based native implementation, which improves parsing performance. If your external table has many small Parquet files and many columns, the number of data source requests may increase. Use the with serdeproperties clause with parquet.file.cache.size and parquet.io.buffer.size to increase per-request caching. | true: C++ implementation | false: Java implementation | — |
odps.security.enabledownloadprivilege | Enables download permission control, letting you restrict which roles or users can use Tunnel to download tables and instances. For details, see Download permission control. | true: enabled | false: disabled | — |
odps.security.ip.whitelist.services | A service whitelist that lets specified Alibaba Cloud services access the project without requiring individual IP addresses. Commonly used with Alibaba Cloud services such as DataHub and LogShipper (Simple Log Service (SLS)). The value for SLS is AliyunLogSLRService,AliyunLogDefaultService. | Comma-separated service names (must be registered in MaxCompute in advance) | — |
For odps.sql.groupby.orderby.position.alias, enabling this property at the project level may affect how existing tasks are parsed and executed. Before changing this property, verify that existing tasks run correctly under the new behavior. If they do not, set the property at the session level instead.
Set project properties
SETPROJECT <KEY>=<VALUE>;Parameters
| Parameter | Description |
|---|---|
KEY | The property name. See the property table in View project properties for available keys. |
VALUE | The property value. |
Property changes take effect within 0–5 minutes. Wait 5 minutes before verifying the result. To set properties for the current session only, use set.Example
Allow full table scans in the project:
SETPROJECT odps.sql.allow.fullscan=true;Manage account systems
By default, a MaxCompute project recognizes only the Alibaba Cloud account system (ALIYUN), not the RAM user system. Use the following commands to view and modify account systems.
View account systems
LIST accountproviders;Returns the account systems that are supported by the current project. The supported systems are ALIYUN and RAM.
Add the RAM user system
ADD accountprovider ram;Remove the RAM user system
REMOVE accountprovider ram;