This topic describes how to use common commands to manage resources on the MaxCompute client.

You can also search and upload resources by using the visualized online data development tools offered in DataWorks.

Add a resource

add file <local_file> [as alias] [comment 'cmt'][-f];
add archive <local_file> [as alias] [comment 'cmt'][-f];
add table <table_name> [partition (spec)] [as alias] [comment 'cmt'][-f];
add <PY | JAR> <localfile[.py |.jar]> [COMMENT 'cmt'][-f];


Adds a resource to MaxCompute.

  • file/archive/table/jar/py: indicates the resource type. For more information, see Resources.
  • Local_file: indicates the path of the local file. The file name is used as the resource name, which uniquely identifies a resource.
  • table_name: indicates the table name in MaxCompute. Currently, external tables cannot be added as resources.
  • [PARTITION (spec)]: If the resource you want to add is a partitioned table, MaxCompute considers only a partition as a resource, not the entire partitioned table.
  • alias: specifies a resource name. If this parameter is not specified, the file name is used as a resource name by default. Jar and Python resources do not support this parameter.
  • [comment 'cmt']: adds a comment for a resource.
  • [-f]: overwrites the original resource that has the same name as the current resource. If this parameter is not specified and a duplicate resource name exists, the operation fails.
-- Add a partitioned table resource named sale.res to MaxCompute.
odps@ odps_public_dev>add table sale_detail partition (ds='20150602') as sale.res comment 'sale detail on 20150602' -f;
OK: Resource 'sale.res' have been updated.
Note Currently, the size of each resource file cannot exceed 500 MB. The resource size referenced by a single SQL or MapReduce task cannot exceed 2,048 MB. For more limits, see MR limits.

View the resource list



Views all resources in the current project.

odps@ $project_name>list resources;
Resource Name      Comment      Last Modified Time        Type
1234.txt                        2014-02-27 07:07:56       file
mapred.jar                      2014-02-27 07:07:57       jar

Download resources

GET RESOURCE <resource_name> <path>;


Downloads MaxCompute resources to your local device. The resource type must be FILE, JAR, ARCHIVE, or PY.

  • resource_name: indicates the name of the resource to be downloaded.
  • path: specifies the path for saving a resource to your local device.
odps@ $project_name>get resource odps-udf-examples.jar d:\;

Delete a resource

DROP RESOURCE <resource_name>; 


Deletes an existing resource.


resource_name: indicates the name of the resource you want to delete. That is the resource name specified when you create the resource.