All Products
Search
Document Center

MaxCompute:ADD PY

Last Updated:May 30, 2025

Add Python type resources to a MaxCompute project for data processing and analysis.

Limits

  • MaxCompute does not allow you to add external tables as resources.

  • Schema evolution is not allowed for tables that are added as resources. If a schema evolution is performed on a table that is added as a resource, you must add the table as a resource again.

  • The size of each resource file cannot exceed 2,048 MB. The size of resources referenced by a single SQL or MapReduce job cannot exceed 2,048 MB.

  • This statement is a CMD statement and can be executed only on the MaxCompute client (odpscmd).

Syntax

add py <local_file> [comment '<comment>'][-f];

Parameters

  • Resource type parameter:

    py: required. A resource type. For more information about resource types, see Resource.

  • Common parameters

    • local_file: Required. The local file path. The file name must be used as the resource name, which serves as a unique identifier. When the file is placed in the client's bin folder, you only need to write the file name without specifying the file path.

    • comment: Optional. Resource comment.

    • -f: Optional. If there is a resource with the same name, this operation will overwrite the existing resource. If this option is not specified, however, the operation will fail when a resource with the same name exists.

Examples

Add a Python resource to a MaxCompute project. Sample statement:

add py python.py [comment '<comment>'][-f];

The following result is returned:

OK: Resource 'python.py' have been created.

Related statements