libZSservicesZSamazonka-s3ZSamazonka-s3
Copyright(c) 2013-2021 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone

Amazonka.S3.SelectObjectContent

Description

This action filters the contents of an Amazon S3 object based on a simple structured query language (SQL) statement. In the request, along with the SQL expression, you must also specify a data serialization format (JSON, CSV, or Apache Parquet) of the object. Amazon S3 uses this format to parse object data into records, and returns only records that match the specified SQL expression. You must also specify the data serialization format for the response.

This action is not supported by Amazon S3 on Outposts.

For more information about Amazon S3 Select, see Selecting Content from Objects in the Amazon S3 User Guide.

For more information about using SQL with Amazon S3 Select, see SQL Reference for Amazon S3 Select and S3 Glacier Select in the Amazon S3 User Guide.

Permissions

You must have s3:GetObject permission for this operation. Amazon S3 Select does not support anonymous access. For more information about permissions, see Specifying Permissions in a Policy in the Amazon S3 User Guide.

Object Data Formats

You can use Amazon S3 Select to query objects that have the following format properties:

  • CSV, JSON, and Parquet - Objects must be in CSV, JSON, or Parquet format.
  • UTF-8 - UTF-8 is the only encoding type Amazon S3 Select supports.
  • GZIP or BZIP2 - CSV and JSON files can be compressed using GZIP or BZIP2. GZIP and BZIP2 are the only compression formats that Amazon S3 Select supports for CSV and JSON files. Amazon S3 Select supports columnar compression for Parquet using GZIP or Snappy. Amazon S3 Select does not support whole-object compression for Parquet objects.
  • Server-side encryption - Amazon S3 Select supports querying objects that are protected with server-side encryption.

    For objects that are encrypted with customer-provided encryption keys (SSE-C), you must use HTTPS, and you must use the headers that are documented in the GetObject. For more information about SSE-C, see Server-Side Encryption (Using Customer-Provided Encryption Keys) in the Amazon S3 User Guide.

    For objects that are encrypted with Amazon S3 managed encryption keys (SSE-S3) and Amazon Web Services KMS keys (SSE-KMS), server-side encryption is handled transparently, so you don't need to specify anything. For more information about server-side encryption, including SSE-S3 and SSE-KMS, see Protecting Data Using Server-Side Encryption in the Amazon S3 User Guide.

Working with the Response Body

Given the response size is unknown, Amazon S3 Select streams the response as a series of messages and includes a Transfer-Encoding header with chunked as its value in the response. For more information, see Appendix: SelectObjectContent Response.

GetObject Support

The SelectObjectContent action does not support the following GetObject functionality. For more information, see GetObject.

  • Range: Although you can specify a scan range for an Amazon S3 Select request (see SelectObjectContentRequest - ScanRange in the request parameters), you cannot specify the range of bytes of an object to return.
  • GLACIER, DEEP_ARCHIVE and REDUCED_REDUNDANCY storage classes: You cannot specify the GLACIER, DEEP_ARCHIVE, or REDUCED_REDUNDANCY storage classes. For more information, about storage classes see Storage Classes in the Amazon S3 User Guide.

Special Errors

For a list of special errors for this operation, see List of SELECT Object Content Error Codes

Related Resources

Synopsis

Creating a Request

data SelectObjectContent Source #

Request to filter the contents of an Amazon S3 object based on a simple Structured Query Language (SQL) statement. In the request, along with the SQL expression, you must specify a data serialization format (JSON or CSV) of the object. Amazon S3 uses this to parse object data into records. It returns only records that match the specified SQL expression. You must also specify the data serialization format for the response. For more information, see S3Select API Documentation.

See: newSelectObjectContent smart constructor.

Constructors

SelectObjectContent' 

Fields

Instances

Instances details
Eq SelectObjectContent Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

Show SelectObjectContent Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

Generic SelectObjectContent Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

Associated Types

type Rep SelectObjectContent :: Type -> Type #

NFData SelectObjectContent Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

Methods

rnf :: SelectObjectContent -> () #

Hashable SelectObjectContent Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

AWSRequest SelectObjectContent Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

Associated Types

type AWSResponse SelectObjectContent #

ToHeaders SelectObjectContent Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

ToPath SelectObjectContent Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

ToQuery SelectObjectContent Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

ToElement SelectObjectContent Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

ToXML SelectObjectContent Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

type Rep SelectObjectContent Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

type Rep SelectObjectContent = D1 ('MetaData "SelectObjectContent" "Amazonka.S3.SelectObjectContent" "libZSservicesZSamazonka-s3ZSamazonka-s3" 'False) (C1 ('MetaCons "SelectObjectContent'" 'PrefixI 'True) (((S1 ('MetaSel ('Just "sSECustomerAlgorithm") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "sSECustomerKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (Sensitive Text))) :*: S1 ('MetaSel ('Just "requestProgress") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe RequestProgress)))) :*: (S1 ('MetaSel ('Just "sSECustomerKeyMD5") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just "scanRange") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ScanRange)) :*: S1 ('MetaSel ('Just "expectedBucketOwner") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text))))) :*: ((S1 ('MetaSel ('Just "bucket") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 BucketName) :*: (S1 ('MetaSel ('Just "key") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ObjectKey) :*: S1 ('MetaSel ('Just "expression") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))) :*: (S1 ('MetaSel ('Just "expressionType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ExpressionType) :*: (S1 ('MetaSel ('Just "inputSerialization") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 InputSerialization) :*: S1 ('MetaSel ('Just "outputSerialization") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 OutputSerialization))))))
type AWSResponse SelectObjectContent Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

newSelectObjectContent Source #

Create a value of SelectObjectContent with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:sSECustomerAlgorithm:SelectObjectContent', selectObjectContent_sSECustomerAlgorithm - The SSE Algorithm used to encrypt the object. For more information, see Server-Side Encryption (Using Customer-Provided Encryption Keys.

$sel:sSECustomerKey:SelectObjectContent', selectObjectContent_sSECustomerKey - The SSE Customer Key. For more information, see Server-Side Encryption (Using Customer-Provided Encryption Keys.

$sel:requestProgress:SelectObjectContent', selectObjectContent_requestProgress - Specifies if periodic request progress information should be enabled.

$sel:sSECustomerKeyMD5:SelectObjectContent', selectObjectContent_sSECustomerKeyMD5 - The SSE Customer Key MD5. For more information, see Server-Side Encryption (Using Customer-Provided Encryption Keys.

$sel:scanRange:SelectObjectContent', selectObjectContent_scanRange - Specifies the byte range of the object to get the records from. A record is processed when its first byte is contained by the range. This parameter is optional, but when specified, it must not be empty. See RFC 2616, Section 14.35.1 about how to specify the start and end of the range.

ScanRangemay be used in the following ways:

  • <scanrange><start>50</start><end>100</end></scanrange> - process only the records starting between the bytes 50 and 100 (inclusive, counting from zero)
  • <scanrange><start>50</start></scanrange> - process only the records starting after the byte 50
  • <scanrange><end>50</end></scanrange> - process only the records within the last 50 bytes of the file.

$sel:expectedBucketOwner:SelectObjectContent', selectObjectContent_expectedBucketOwner - The account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

$sel:bucket:SelectObjectContent', selectObjectContent_bucket - The S3 bucket.

$sel:key:SelectObjectContent', selectObjectContent_key - The object key.

$sel:expression:SelectObjectContent', selectObjectContent_expression - The expression that is used to query the object.

$sel:expressionType:SelectObjectContent', selectObjectContent_expressionType - The type of the provided expression (for example, SQL).

$sel:inputSerialization:SelectObjectContent', selectObjectContent_inputSerialization - Describes the format of the data in the object that is being queried.

$sel:outputSerialization:SelectObjectContent', selectObjectContent_outputSerialization - Describes the format of the data that you want Amazon S3 to return in response.

Request Lenses

selectObjectContent_requestProgress :: Lens' SelectObjectContent (Maybe RequestProgress) Source #

Specifies if periodic request progress information should be enabled.

selectObjectContent_scanRange :: Lens' SelectObjectContent (Maybe ScanRange) Source #

Specifies the byte range of the object to get the records from. A record is processed when its first byte is contained by the range. This parameter is optional, but when specified, it must not be empty. See RFC 2616, Section 14.35.1 about how to specify the start and end of the range.

ScanRangemay be used in the following ways:

  • <scanrange><start>50</start><end>100</end></scanrange> - process only the records starting between the bytes 50 and 100 (inclusive, counting from zero)
  • <scanrange><start>50</start></scanrange> - process only the records starting after the byte 50
  • <scanrange><end>50</end></scanrange> - process only the records within the last 50 bytes of the file.

selectObjectContent_expectedBucketOwner :: Lens' SelectObjectContent (Maybe Text) Source #

The account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

selectObjectContent_expression :: Lens' SelectObjectContent Text Source #

The expression that is used to query the object.

selectObjectContent_expressionType :: Lens' SelectObjectContent ExpressionType Source #

The type of the provided expression (for example, SQL).

selectObjectContent_inputSerialization :: Lens' SelectObjectContent InputSerialization Source #

Describes the format of the data in the object that is being queried.

selectObjectContent_outputSerialization :: Lens' SelectObjectContent OutputSerialization Source #

Describes the format of the data that you want Amazon S3 to return in response.

Destructuring the Response

data SelectObjectContentResponse Source #

See: newSelectObjectContentResponse smart constructor.

Constructors

SelectObjectContentResponse' 

Fields

Instances

Instances details
Eq SelectObjectContentResponse Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

Read SelectObjectContentResponse Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

Show SelectObjectContentResponse Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

Generic SelectObjectContentResponse Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

Associated Types

type Rep SelectObjectContentResponse :: Type -> Type #

NFData SelectObjectContentResponse Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

type Rep SelectObjectContentResponse Source # 
Instance details

Defined in Amazonka.S3.SelectObjectContent

type Rep SelectObjectContentResponse = D1 ('MetaData "SelectObjectContentResponse" "Amazonka.S3.SelectObjectContent" "libZSservicesZSamazonka-s3ZSamazonka-s3" 'False) (C1 ('MetaCons "SelectObjectContentResponse'" 'PrefixI 'True) (S1 ('MetaSel ('Just "payload") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe SelectObjectContentEventStream)) :*: S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))

newSelectObjectContentResponse Source #

Create a value of SelectObjectContentResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:payload:SelectObjectContentResponse', selectObjectContentResponse_payload - The array of results.

$sel:httpStatus:SelectObjectContentResponse', selectObjectContentResponse_httpStatus - The response's http status code.

Response Lenses