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, as well as CSV- and JSON-formatted objects compressed by gzip and bzip2. In addition, you can save your extraction results 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 run SQL queries using the COS console, APIs, SDKs, or COSCMD. Note that certain restrictions apply to 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.