This topic describes how to use the SecurityManager.runQuery() method of MaxCompute SDK for Java to run security-related commands on the MaxCompute client.
Prerequisites
- The IntelliJ IDEA development tool is installed. For more information, see Install IntelliJ IDEA.
- A MaxCompute project is connected to MaxCompute Studio. For more information, see Manage project connections.
- Project dependencies are added in MaxCompute Studio.
You must make sure that the following dependency is configured because the SecurityManager class is contained in the odps-sdk-core package:
You can obtain the latest version of the SDK by searching for odps-sdk-core at search.maven.org.<dependency> <groupId>com.aliyun.odps</groupId> <artifactId>odps-sdk-core</artifactId> <version>X.X.X-public</version> </dependency>
Background information
You can run security-related commands by using one of the following methods:
- Use the MaxCompute client. For more information, see Project security configurations.
The commands that start with any of the following keywords are the security-related commands of MaxCompute:
GRANT/REVOKE ... SHOW GRANTS/ACL/PACKAGE/LABEL/ROLE/PRINCIPALS SHOW PRIV/PRIVILEGES LIST/ADD/REOVE USERS/ROLES/TRUSTEDPROJECTS DROP/CREATE ROLE CLEAR EXPIRED GRANTS DESC/DESCRIBE ROLE/PACKAGE CREATE/DELETE/DROP PACKAGE ADD ... TO PACKAGE REMOVE ... FROM PACKAGE ALLOW/DISALLOW PROJECT INSTALL/UNINSTALL PACKAGE LIST/ADD/REMOVE ACCOUNTPROVIDERS SET LABLE ...
- Use the
SecurityManager.runQuery()
method of MaxCompute SDK for Java. For more information, see the MaxCompute SDK for Java documentation.Note The security-related commands of MaxCompute are not SQL statements. Therefore, you cannot run security-related commands by using SQLTask.