The COS Select feature uses structured query language (SQL) to filter objects stored in COS in order to extract a specific object and get the desired data. By filtering object data using this feature, you can reduce the amount of data transferred by COS, which helps lower the cost and delay in data extraction.
The COS Select feature currently allows you to extract objects stored in CSV and JSON formats and compressed by gzip and bzip2 (for CSV and JSON objects only). In addition, you can save the extraction result in CSV and JSON formats and specify how to separate the result records.
You can pass in an SQL expression to COS in your request. COS Select currently only supports certain SQL expressions. For more information, see SQL Functions.
You can use the COS SDK, API, COSCMD, or COS Console to execute on SQL queries. Note that certain restrictions apply on file extraction if you use the COS Console: Up to 128 MB of files can be extracted, and up to 40 MB of data can be returned. To extract more data, use other methods.
The following restrictions apply to COS Select:
cos:GetObjectpermission to the queried object. A root account has this permission by default.
SQL clauses currently supported by COS Select include:
For more information on SQL clauses, see SELECT Command.
Functions currently supported by COS Select include:
- For more information on SQL functions, see SQL Functions.
COS Select currently supports the following operators:
AND, NOT, OR
<, >, <=, >=, =, <>, !=, BETWEEN, IN
+, -, *, %
- For more information on operators, see Operators.
You can initiate an extraction request using the console, API, or SDK:
If a problem occurs when you execute on a query, COS Select will return an error code and associated error message. For the list of error codes and descriptions, see Special Error Codes.