A package creator creates a package in a MaxCompute project.
Background information
In this topic, an Alibaba Cloud account owns multiple MaxCompute projects and needs to share specific tables, resource files, and user-defined functions (UDFs) in Project A with other projects. You can share the resources with other projects by using one of the following methods:
Add the users in the other projects to Project A and grant each user the permissions to access the resources. This method is complex. We recommend that you do not use this method in cross-project resource access scenarios. We recommend that you use this method only when fine-grained resource access control is required for a member of your project team. For more information about the syntax for authorization commands, see ACL-based access control.
Use the package-based access control mechanism.
The package-based access control mechanism is used to share data and resources across projects. The owner of Project A packages the resources that other projects need to use and the operation permissions on the resources and authorizes the owners of other projects to install the package. After the package is installed, the owners of the other projects can determine whether to authorize users in their projects to access the resources in the package. The following figure shows how the package-based access control mechanism is implemented.
Limits
Before you use the package-based access control mechanism, take note of the following limits:
A maximum of 1,000 resources can be added to a package.
A package can be installed for a maximum of 100,000 MaxCompute projects.
A maximum of 100 packages that are created in a MaxCompute project can be installed in another MaxCompute project.
A maximum of 100,000 packages can be created in a MaxCompute project.
A maximum of 100,000 packages can be installed in a MaxCompute project.
This statement is a CMD statement and can only be executed on the MaxCompute client (odpscmd).
Syntax
create package <package_name>;
Parameters
Parameter | Required | Description |
package_name | Yes | The name of the package, which is unique within a project. The name contains letters, underscores (_), and digits but cannot start with a digit. You can run the |
Examples
In this example, the Alibaba Cloud account Bob@aliyun.com is the owner of the test_project_a project and needs to authorize other projects to access specific resources in the test_project_a project. Create a package. Sample statements:
-- Use the Alibaba Cloud account Bob@aliyun.com to access the project test_project_a.
use test_project_a;
-- Create a package.
create package datashare;
Related statements
ADD TO PACKAGE: adds the resources that are required by a user to the package that is created by the user.
REMOVE FROM PACKAGE: removes resources from a package.
ALLOW PROJECT: authorizes other projects to use a package.
DISALLOW PROJECT: revokes access permissions on a package from a project.
DESCRIBE PACKAGE: views the details of a package that is created in a MaxCompute project.
DROP PACKAGE: deletes a package.
INSTALL PACKAGE: installs a package in a MaxCompute project.
UNINSTALL PACKAGE: uninstalls a package that is installed in a MaxCompute project.
GRANT: authorizes a user or role to access a package.
REVOKE: revokes access permissions on a package from a user or role.
SHOW: views the packages that are created or installed in a MaxCompute project.