Created
October 15, 2018 09:21
-
-
Save shiro01/4a07f9f5d3a47fd734264a9c8e862197 to your computer and use it in GitHub Desktop.
CSVファイル読み込むAthenaテーブル作成用CREATE文 (LazySimpleSerDe)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE EXTERNAL TABLE IF NOT EXISTS test_db.test_table ( | |
`test_date` date, | |
`test_id` string, | |
`test_num` int | |
) | |
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' | |
WITH SERDEPROPERTIES ( | |
'serialization.format' = ',', | |
'field.delim' = ',' | |
) LOCATION 's3://test-bucket/test-folder/' | |
TBLPROPERTIES ('has_encrypted_data'='false'); | |
-- Athenaのテーブル作成参考URL | |
-- CREATE TABLE:https://docs.aws.amazon.com/ja_jp/athena/latest/ug/create-table.html | |
-- | |
-- CSVデータ形式を解析するためのライブラリ(SerDes)は以下の2つある | |
-- ・LazySimpleSerDe :https://docs.aws.amazon.com/ja_jp/athena/latest/ug/lazy-simple-serde.html | |
-- └データに引用符で囲まれた値が含まれていない場合 | |
-- ・OpenCSVSerDe:https://docs.aws.amazon.com/ja_jp/athena/latest/ug/csv.html | |
-- └データの値に引用符が含まれているか、別の区切り文字やエスケープ文字が含まれている場合 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment