Resource

Last Updated: Jun 21, 2016

Command Format:

  1. add file <local_file> [as alias] [comment 'cmt'][-f];
  2. add archive <local_file> [as alias] [comment 'cmt'][-f];
  3. add table <table_name> [partition <(spec)>] [as alias] [comment 'cmt'][-f];
  4. add jar <local_file.jar> [comment 'cmt'][-f];
  5. add py <local_file.py> [comment 'cmt'][-f];

Description:

  • file/archive/table/jar/py indicates the resource type. For the introduction of resource type, refer to [Resource].
  • local_file: path of local file, and take this file name as the resource name. Resource name is a unique identifier of a resource.
  • table_name: table name in ODPS.
  • [PARTITION (spec)]: when the resource to be added is a partition table, ODPS only supports taking a partition as a resource, not a whole partition table.
  • alias: specify the resource name. If not added this parameter, the file name is default to be the resource name. Jar and Py resources do not support the fuction.
  • [comment ‘cmt’]: add comment for resource.
  • [-f]: if the same name resource exists, to add this parameter will cover the original resource. If this parameter is not added and the same name resource exists, the operation will fail.

Example:

  1. odps@ odps_public_dev>add table sale_detail partition (ds='20150602') as sale.res comment 'sale detail on 20150602' -f;
  2. OK: Resource 'sale.res' have been updated.
  3. ---Add a resource named 'sale.res' in ODPS.

Note:

  • At present, each resource file size can not exceed 64MB. The resource size referenced by Single SQL or MapReduce can not exceed 512MB.

Drop Resource

Command Format:

  1. DROP RESOURCE <resource_name>;

Description:

  • resource_name:a specified resource name.

List Resources

Command Format:

  1. LIST RESOURCES;

Description: Check all resources of current project.

Example:

  1. odps@ $project_name>list resources;
  2. Resource Name Comment Last Modified Time Type
  3. 1234.txt 2014-02-27 07:07:56 file
  4. mapred.jar 2014-02-27 07:07:57 jar
Thank you! We've received your feedback.