目次

aws

boto3

Passing credentials as parameters

https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html

AWS Data Wrangler

since 2021-10-24

https://aws-data-wrangler.readthedocs.io/en/stable/

https://pypi.org/project/awswrangler/

DynamoDB に書き込む

Amazon Athena

since 2021-11-26

「Amazon Athena は、標準 SQL を使用して Amazon S3 やその他のフェデレーティッドデータソース内のデータを簡単に分析できるようにするインタラクティブなクエリサービスです。」

https://docs.aws.amazon.com/athena/latest/ug/getting-started.html

やってみる

アップロードしたファイルの先頭

Date,temperature,humidity
2021-07-22 19:15,24.3,62
2021-07-22 19:26,24.6,69

Amazon Athena - クエリエディタ

再びクエリエディタ

入力セット

s3://example-bucket/温湿度

データ形式 CSV

列を定義

テーブルクエリをプレビューに下記のように出てくる

CREATE EXTERNAL TABLE IF NOT EXISTS `default`.`temperature_humidity` (
`Date` date,
`temperature` float,
`humidity` float
)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
WITH SERDEPROPERTIES (
'serialization.format' = ',',
'field.delim' = ','
) LOCATION 's3://example-bucket/温湿度'
TBLPROPERTIES ('has_encrypted_data'='false');

やってみるとたしかにテーブルはできるが、プレビューすると date が空欄になる。

調べてみるとこういう話

https://qiita.com/kazurof/items/23cba632b12fd5c7140e

https://aws.amazon.com/jp/premiumsupport/knowledge-center/query-table-athena-timestamp-empty/

Date を string にしてテーブルを作り直してみた

com.amazonaws.services.s3.model.AmazonS3Exception: Access Denied

というエラーが出て、クエリーできなくなった。

とりあえずここまで