This topic describes how to use commands to enter a project and set project properties (including permissions and IP address whitelists).
Enter a project
- Enters a specific project. After you enter the project, you can manage all objects in the project. You must have access permissions on the project.
- If the project does not exist or the current user does not belong to the project, an error is returned.
- Enter a specific project.
-- Enter the my_project_test project. The user has access permissions on this project. odps @ my_project>use my_project_test;
- Access the objects in the project.
MaxCompute automatically searches for the table under the my_project_test project. If this table exists, data in the table is returned. If this table does not exist, the session returns an exception and exits.
-- Query the test_src table in the my_project_test project. odps @ my_project_test>SELECT * FROM test_src;
- Access objects in another project. To do this, you must specify the project name.
-- Access the test_src table in another project my_project2 from the my_project_test project. odps @ my_project_test>select * from my_project2.test_src;
- The preceding examples are run on the MaxCompute client. In MaxCompute, no command keywords, project names, table names, or column names are case-sensitive.
- Every project you create is a MaxCompute project.
- You cannot create or delete projects with MaxCompute. The DataWorks console offers more project operations. For more information, see Project list.
Views the projects created by the Alibaba Cloud account.
Set project properties
- Sets project properties when specifying <KEY>=<VALUE>. The following example shows
how to allow a full table scan.
- Displays the project properties if <KEY>=<VALUE> is not specified.
-- Displays the parameters set by running setproject. setproject;
|Property||Configured by||Description||Value range|
|odps.sql.allow.fullscan||Project owner||Determines whether to allow a full table scan.||true (allow), false (not allow)|
|odps.table.drop.ignorenonexistent||All users||Specifies whether to report an error if you delete a table that does not exist.||true (not report), false (report)|
||optional, mandatory, inherit|
|odps.table.lifecycle.value||Project owner||Indicates the default lifecycle.||1 to 37231 (default value)|
|odps.security.ip.whitelist||Project owner||Specifies the whitelist of IP addresses that are authorized to access the project over the Internet.||IP address list, separated with commas (,).|
|odps.security.vpc.whitelist||Project owner||Specifies the whitelist of IP addresses that are authorized to access the project over a VPC.||Region_ID, VPC_ID, IP address list. They are separated with commas (,).|
|odps.instance.remain.days||Project owner||Indicates the retention period for instance information, in days.||3 to 30|
|READ_TABLE_MAX_ROW||Project owner||Indicates the number of data entries returned by the SELECT statement.||1 to 10000|
|odps.sql.type.system.odps2||Project owner||Indicates whether to enable new data types in MaxCompute V2.0.||true (enabled), false (disabled)|
|odps.sql.hive.compatible||Project owner||Specifies whether to enable the Hive compatible mode. After the Hive compatible mode is enabled, MaxCompute can support Hive syntax, such as inputRecordReader, outputRecordReader, and Serde.||true (enabled), false (disabled)|
- Some implicit type conversions may be disabled. For example, errors may occur or precision
may be reduced if the data type is converted from STRING to BIGINT, from STRING to
DATETIME, from DOUBLE to BIGINT, from DECIMAL to DOUBLE, or from DECIMAL to BIGINT.
In these cases, you can use the
CASTfunction to convert the data type.
- Constant type changes. A single integer constant, such as 123, is classified as the BIGINT type in the original data types, whereas it is classified as the INT type in the new data types.
- UDF resolution results may change. Assume that a UDF contains two overloads: BIGINT and INT. After UDF resolution, the BIGINT overload is obtained in the original data types, whereas the INT overload may be obtained in the new data types.
Set IP address whitelists
MaxCompute supports whitelists of IP addresses that are authorized to access projects over the Internet or a VPC. odps.security.ip.whitelist is the parameter that specifies the whitelist of IP addresses that are authorized to access projects over the Internet. odps.security.vpc.whitelist is the parameter that specifies the whitelist of IP addresses that are authorized to access projects over a VPC.
- To set a whitelist of IP addresses that are authorized to access projects over the
Internet, run the following command:
setproject odps.security.ip.whitelist= IP Address
- To set a whitelist of IP addresses that are authorized to access projects over a VPC,
run the following command:
setproject odps.security.vpc.whitelist= RegionID_VPCID[IP address]
- After an IP address whitelist is configured for a project, only IP addresses, for example, the outbound IP addresses of the odpscmd client or SDK, in the whitelist are authorized to access the project.
- After you set the IP address whitelist, you need to wait five minutes before it takes effect.
- IP Address: indicates an IP address. In a VPC, it is the IP address of the VPC.
Whitelists support IPv6 addresses. IP addresses in whitelists can be expressed in the following formats:
- IP addresses, for example, 126.96.36.199 and FE80:0202:B3FF:FE1E:8329.
- CIDR blocks, for example, 100.116.0.0/16 and FE80:0101:4567:F456:0202:B3FF:1111:1111/126.
- IP address ranges, for example, 188.8.131.52 - 184.108.40.206 and FE80:0101:4567:F456:0202:B3FF:FE1E:8330 - FE80:0101:4567:F456:0202:B3FF:FE1E:8331.
- ReigonID: indicates the ID of the region to which the VPC belongs. The following table lists
the mappings between regions and region IDs.
Region Region ID China (Zhangjiakou-Beijing Winter Olympics) cn-zhangjiakou China (Beijing) cn-beijing China (Shenzhen) cn-shenzhen China (Chengdu) cn-chengdu China (Shanghai) cn-shanghai China (Hangzhou) cn-hangzhou Shanghai Tower cn China (Hong Kong) cn-hongkong Singapore (Singapore) ap-southeast-1 Australia (Sydney) ap-southeast-2 Malaysia (Kuala Lumpur) ap-southeast-3 Indonesia (Jakarta) ap-southeast-5 Japan (Tokyo) ap-northeast-1 Germany (Frankfurt) eu-central-1 US (Silicon Valley) us-west-1 US (Virginia) us-east-1 India (Mumbai) ap-south-1 UAE (Dubai) me-east-1 UK (London) eu-west-1
- VPCID: indicates the ID of a VPC.
- Use a command line tool to set an IP address whitelist for the Internet.
- Use a command line tool to set an IP address whitelist for a VPC. In the following
example, the region IDs are cn-beijing and cn-chengdu. These regions correspond to
VPC IDs 154286 and 461230, respectively.
- When a whitelist is cleared for a project, MaxCompute considers that whitelist disabled
for the project.
-- Disable an IP address whitelist for the Internet. setproject odps.security.ip.whitelist=; -- Disable an IP address whitelist for a VPC. setproject odps.security.vpc.whitelist=;