All Products
Search
Document Center

MaxCompute:ADD PY

Last Updated:Oct 17, 2023

Adds Python code as a resource to a MaxCompute project.

Limits

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

  • The maximum size of a resource file is 2048 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 only be executed 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 path of the file that you want to add. The file name is used as the resource name, which uniquely identifies a resource.

    • comment: optional. The comment of the resource.

    • -f: optional. If a duplicate resource name exists, the existing resource is replaced. If you do not specify this option and a duplicate resource name exists, the resource fails to be added.

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