soto-project / soto

Swift SDK for AWS that works on Linux, macOS and iOS
https://soto.codes
Apache License 2.0
868 stars 81 forks source link

Issue with selectObjectContent SQL query #689

Closed mladen-kobiljski closed 11 months ago

mladen-kobiljski commented 11 months ago

I have a simple json file I'm trying to query.

let input = S3.InputSerialization(json: .init(type: .document))
let output = S3.OutputSerialization(json: .init(recordDelimiter: ","))

let select = S3.SelectObjectContentRequest(bucket: "data-sample",
expression: "Select * from S3Object[*]",
expressionType: .sql,
inputSerialization: input,
key: "test.json",
outputSerialization: output)

let resp = try await s3.selectObjectContent(select)

The request is failing with next error: The operation couldn’t be completed. (SotoCore.AWSResponseError error 1.)

adam-fowler commented 11 months ago

SelectObjectContent requires special handling. The generated version doesn't work.

You have two possible solutions 1) use the custom version of the function selectObjectContentEventStream or 2) you could try the branch 7.x.x of Soto. This has major structural changes, fully async/await internals and a reworking of the encoding and decoding of requests and responses. And selectObjectContent should work there

adam-fowler commented 11 months ago

The alpha version 7.0 is out with a working version of this. Going to close this now.