JAWS DAYS 2020
CSVから、「佐々木」で「男性」で「未成年」なデータを取得
7
S3 Select
$ aws s3api select-object-content ¥
--bucket=example-s3-select ¥
--key=sample.csv ¥
--input-serialization '{"CSV":{"FileHeaderInfo": "USE", "QuoteEscapeCharacter":"¥¥"}}' ¥
--output-serialization '{"CSV":{"QuoteFields":"ALWAYS","QuoteEscapeCharacter":"¥¥"}}' ¥
--expression "SELECT * FROM s3object s WHERE s.name LIKE '%佐々木%' AND s.gender = '男性
' AND s.age < '19'" ¥
--expression-type SQ output.txt
$ cat output.txt
"177","佐々木 裕太","男性","16","
[email protected]
“515”,“佐々木 拓真","男性","18","
[email protected]
"1133","佐々木 浩","男性","16","
[email protected]
"1869","佐々木 京助","男性","12","
[email protected]
"2235","佐々木 裕美子","男性","17","
[email protected]
"2572","佐々木 洋介","男性","10","
[email protected]
"2854","佐々木 美加子","男性","10","
[email protected]
"3176","佐々木 真綾","男性","12","
[email protected]
"3447","佐々木 裕美子","男性","15","
[email protected]
"3567","佐々木 太郎","男性","15","
[email protected]
"4098","佐々木 花子","男性","16","
[email protected]
"4377","佐々木 真綾","男性","11","
[email protected]
"4458","佐々木 裕美子","男性","13","
[email protected]
…
ファイル取得後にアプリ側で選別するのではなく
取得時に必要なデータのみを取得できる機能