All Products
Search
Document Center

MaxCompute:ADD TO PACKAGE

Last Updated:Mar 25, 2026

Adds resources to a package so that other projects can access them under controlled permissions.

ADD TO PACKAGE is a CMD statement. Run it on the MaxCompute client (odpscmd).

Where this fits in the data-sharing workflow: CREATE PACKAGEADD TO PACKAGEALLOW PROJECTINSTALL PACKAGE

Syntax

add <object_type> <object_name> to package <package_name> [with privileges <privileges>];

To add all objects of a given type at once, use an asterisk (*) as a wildcard:

add <object_type> * to package <package_name> [with privileges <privileges>];

Parameters

ParameterRequiredDescription
object_typeYesThe type of the object to add. One object type per statement. For supported types, see Permissions.
object_nameYesThe name of the object to add. Use plain names only — do not prefix with the project name (for example, use my_table, not project_a.my_table).
package_nameYesThe name of the package. Run show packages; on the MaxCompute client to list packages you have created.
privilegesNoThe permissions to grant on the object. Defaults to Read, Describe, and Select. Permissions are bound to the object and cannot be updated later — to change permissions, remove the object and re-add it with the new permissions. For available permissions, see Permissions.

Look up object names

Object typeCommand
Table or viewshow tables;
Resource filelist resources;
Functionlist functions;
Instanceshow instances;

Limitations

  • Projects cannot be added to a package.

  • A package can contain a maximum of 1,000 resources.

  • Resources are not snapshotted when added. Package users always access the latest version of the data.

Usage notes

  • Tables and views: Use add table * to add all tables in the project at once.

  • Resource files: Specify the resource file name without the project prefix. For example, to add udtf.jar, run add resource udtf.jar to package <package_name>;.

  • Functions: Functions are added by name. Run list functions; to confirm the exact name before adding.

  • Instances: Add instances by their instance ID, retrieved with show instances;.

  • Permissions: If you omit with privileges, the default permissions (Read, Describe, Select) are applied. Permissions are inseparable from the resource — to grant different permissions on the same resource, remove it first with REMOVE FROM PACKAGE, then re-add it.

Examples

Add a resource file:

add Resource udtf.jar to package datashare;

Add a single table:

add Table sale_detail to package datashare;

Add all tables at once:

add Table * to package datashare;

Add a function:

add Function my_udf to package datashare;

What's next