Obtains metadata about a CSV or JSON object, including the total number of rows, splits, and columns (CSV only). Each object consists of data blocks, where each block corresponds to a split of consecutive rows. If the metadata does not already exist, the entire object is scanned and the results are recorded for subsequent calls without rescanning.
Usage notes
-
To call the CreateSelectObjectMeta operation, you must have write permissions on the object.
-
If the operation is successful, HTTP status code 200 is returned. If the object is not a valid CSV or JSON LINES object, or if the specified delimiter does not match existing CSV objects, HTTP status code 400 is returned.
Syntax
This operation uses the following request syntax for CSV and JSON objects.
-
Request syntax for CSV objects
POST /samplecsv?x-oss-process=csv/meta <CsvMetaRequest> <InputSerialization> <CompressionType>None</CompressionType> <CSV> <RecordDelimiter>Base64-encoded character</RecordDelimiter> <FieldDelimiter>Base64-encoded character</FieldDelimiter> <QuoteCharacter>Base64-encoded character</QuoteCharacter> </CSV> </InputSerialization> <OverwriteIfExists>false|true</OverwriteIfExists> </CsvMetaRequest>
-
Request syntax for JSON objects
POST /samplecsv?x-oss-process=json/meta <JsonMetaRequest> <InputSerialization> <CompressionType>None</CompressionType> <JSON> <Type>LINES</Type> </JSON> </InputSerialization> <OverwriteIfExists>false|true</OverwriteIfExists> </JsonMetaRequest>
Request elements
|
Element |
Type |
Description |
|
CsvMetaRequest |
Container |
The container for the CreateSelectObjectMeta request for CSV objects. Child nodes: InputSerialization Parent nodes: none |
|
JsonMetaRequest |
Container |
The container for the CreateSelectObjectMeta request for JSON objects. Child nodes: InputSerialization Parent nodes: none |
|
InputSerialization |
Container |
Optional. The input serialization parameters. Child nodes: CompressionType, CSV, and JSON Parent nodes: CsvMetaRequest and JsonMetaRequest |
|
OverwriteIfExists |
bool |
Optional. Specifies whether to recalculate the SelectMeta and overwrite the existing data. A value of false returns the existing result directly. Default value: false. Child nodes: none Parent nodes: CsvMetaRequest and JsonMetaRequest |
|
CompressionType |
Enumeration |
Optional. The compression type of the object. Valid value: None. Child nodes: none Parent nodes: InputSerialization |
|
RecordDelimiter |
String |
Optional. The Base64-encoded line feed used to separate rows in the CSV object. Default value: \n. Before encoding, the value must be an ANSI value of up to two characters in length. For example, \n indicates a line feed in Java. Child nodes: none Parent nodes: CSV |
|
FieldDelimiter |
String |
Optional. The Base64-encoded delimiter used to separate values in the CSV object. Default value: Before encoding, the value must be an ANSI value of one character in length. For example, Child nodes: none Parent nodes: CSV (input and output) |
|
QuoteCharacter |
String |
Optional. The Base64-encoded quote character for the CSV object. Default value: \". In a CSV object, line feeds and column delimiters enclosed in quotation marks are treated as literal characters. Before encoding, the value must be an ANSI value of one character in length. For example, \" indicates a quotation mark in Java. Child nodes: none Parent nodes: CSV (input) |
|
CSV |
Container |
The input format of the CSV object. Child nodes: RecordDelimiter, FieldDelimiter, and QuoteCharacter Parent nodes: InputSerialization |
|
JSON |
Container |
The input format of the JSON object. Child nodes: Type Parent nodes: InputSerialization |
|
Type |
Enumeration |
The type of the JSON object. Valid value: LINES. |
Response headers
Like SelectObject, CreateSelectObjectMeta returns results as frames.
|
Frame type |
Value |
Payload format |
Description |
|
Meta End Frame (CSV) |
8388614 |
offset | total scanned bytes | status| splits count | rows count | columns count | error message <-8 bytes><------8 bytes------><--4bytes><--4 bytes--><--8 bytes><--4 bytes---><variable size> |
Reports the final state of a CreateSelectObjectMeta operation.
|
|
Meta End Frame (JSON) |
8388615 |
offset | total scanned bytes | status| splits count | rows count | error message <-8 bytes><------8 bytes------><--4bytes><--4 bytes--><--8 bytes><variable size> |
Reports the final state of a CreateSelectObjectMeta operation.
|
Sample requests
The following examples show how to call CreateSelectObjectMeta for CSV and JSON objects:
-
Sample requests for CSV objects
POST /oss-select/bigcsv_normal.csv?x-oss-process=csv%2Fmeta HTTP/1.1 Date: Fri, 25 May 2018 23:06:41 GMT Content-Type: Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,AdditionalHeaders=content-length,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e User-Agent: aliyun-sdk-dotnet/2.8.0.0(windows 16.7/16.7.0.0/x86;4.0.30319.42000) Content-Length: 309 Expect: 100-continue Connection: keep-alive Host: Host <?xml version="1.0"?> <CsvMetaRequest> <InputSerialization> <CSV> <RecordDelimiter>Cg==</RecordDelimiter> <FieldDelimiter>LA==</FieldDelimiter> <QuoteCharacter>Ig==</QuoteCharacter> </CSV> </InputSerialization> <OverwriteIfExisting>false</OverwriteIfExisting> </CsvMetaRequest> -
Sample requests for JSON objects
POST /oss-select/sample.json?x-oss-process=json%2Fmeta HTTP/1.1 Date: Fri, 25 May 2018 23:06:41 GMT Content-Type: Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,AdditionalHeaders=content-length,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e User-Agent: aliyun-sdk-dotnet/2.8.0.0(windows 16.7/16.7.0.0/x86;4.0.30319.42000) Content-Length: 309 Expect: 100-continue Connection: keep-alive Host: Host <?xml version="1.0"?> <JsonMetaRequest> <InputSerialization> <JSON> <Type>LINES</Type> </JSON> </InputSerialization> <OverwriteIfExisting>false</OverwriteIfExisting> </JsonMetaRequest>
ossutil
For more information about the ossutil command for the CreateSelectObjectMeta operation, see create-select-object-meta.