跳至內容

Is it possible to use S3 select to identify schema of data in a S3 file

0

Is it possible to use S3 select to identify schema of data in a S3 file

The file should contain one Json records per line, can S3 select be used to know first level fields of a Json object

Example: For two Json records in a file {a:1, b:2, c:3} {a:1, b:2, c:3, d:4}

I would like S3 select to return a,b,c,d

已提問 1 年前檢視次數 157 次
1 個回答
0

Yes, Amazon S3 Select does not support automatic schema inference, meaning it cannot directly identify or return the list of first-level fields (keys) from JSON records stored in an S3 object. As stated in the AWS documentation, "S3 Select supports querying data that is structured or semi-structured (like CSV or JSON), but does not support schema inference." This means you must already know the field names and structure of your data to write SQL queries against it.

To work around this limitation, you can use alternative tools such as AWS Glue , which can automatically infer schemas from JSON files and generate metadata tables for use with Amazon Athena or other query services. Another option is using a custom AWS Lambda function or a local script (e.g., Python with Pandas or json-schema-infer) to read sample data from the file and programmatically extract all unique top-level keys across the JSON records.

Reference: AWS S3 Select Documentation - JSON Support

已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。