{"id":12613,"date":"2016-12-06T09:00:20","date_gmt":"2016-12-06T00:00:20","guid":{"rendered":"http:\/\/www.techscore.com\/blog\/?p=12613"},"modified":"2018-11-14T16:33:44","modified_gmt":"2018-11-14T07:33:44","slug":"amazonathena","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2016\/12\/06\/amazonathena\/","title":{"rendered":"Amazon Athena \u3092\u3061\u3087\u3063\u3068\u3060\u3051\u3055\u308f\u3063\u3066\u307f\u305f\u3088"},"content":{"rendered":"
\u3053\u3093\u306b\u3061\u306f\u3001\u5bfa\u5ca1\u3067\u3059\u3002 <\/p>\n \u4eca\u5e74\u3082AWS\u6700\u5927\u306e\u30a4\u30d9\u30f3\u30c8\u3001 re:Invent \u3067\u6ca2\u5c71\u306e\u65b0\u30b5\u30fc\u30d3\u30b9\u304c\u7d39\u4ecb\u3055\u308c\u307e\u3057\u305f\u3002 \u4e00\u8a00\u3067\u8a00\u3063\u3066\u3057\u307e\u3048\u3070\u3001AWS\u7248 Google BigQuery \u306e\u3088\u3046\u306a\u30b5\u30fc\u30d3\u30b9\u3067\u3059\u3002 Athena\u306e\u7279\u5fb4\u306f\u3001\u306a\u3093\u3068\u3044\u3063\u3066\u3082\u30b5\u30fc\u30d0\u30ec\u30b9\u3067\u30d5\u30eb\u30de\u30cd\u30fc\u30b8\u30c9\u3067\u3042\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3002 S3\u306b\u4fdd\u5b58\u3057\u3066\u3042\u308b\u30d5\u30a1\u30a4\u30eb\u306b\u5bfe\u3057\u3066\u306eSQL\u30af\u30a8\u30ea\u306b\u306f\u3001EMR\u4e0a\u3067Hive\u3001Presto\u3001Spark\u306a\u3069\u3092\u5229\u7528\u3059\u308b\u30b1\u30fc\u30b9\u304c\u4e00\u822c\u7684\u3067\u3057\u305f\u3002 Athena\u306e\u5185\u90e8\u3067\u306f Presto<\/a> \u304c\u5229\u7528\u3055\u308c\u3066\u304a\u308a\u3001\u30af\u30a8\u30ea\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306a\u3069\u3082\u307b\u3068\u3093\u3069Presto\u305d\u306e\u307e\u307e\u306a\u305f\u3081\u3001EMR\u3067Presto\u3092\u5229\u7528\u3057\u3066\u3044\u305f\u30e6\u30fc\u30b6\u306f\u6bd4\u8f03\u7684\u306b\u5bb9\u6613\u306bAthena\u3078\u79fb\u884c\u3067\u304d\u305d\u3046\u3067\u3059\u3002<\/p>\n Athena\u3092\u4f7f\u3063\u3066\u30af\u30a8\u30ea\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u3042\u3089\u304b\u3058\u3081\u30c6\u30fc\u30d6\u30eb\u3084\u30ab\u30e9\u30e0\u306e\u5b9a\u7fa9\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 CREATE EXTERNAL TABLE \u306e\u8a18\u8ff0\u306fHive\u305d\u306e\u307e\u307e\u3067\u3001\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306e\u5b9a\u7fa9\u306fSerDe\u6307\u5b9a\u3068\u306a\u308a\u307e\u3059\u3002 \u7ba1\u7406\u753b\u9762\u306eCatalogManager\u3067\u306e\u7ba1\u7406\u753b\u9762\u3067\u306e\u30c6\u30fc\u30d6\u30eb\u5b9a\u7fa9\u306f\u3061\u3087\u3063\u3068\u9762\u5012\u3060\u3063\u305f\u306e\u3067\u3001Hive\u306b\u6163\u308c\u3066\u3044\u308b\u5834\u5408\u306fCREATE EXTERNAL TABLE \u6587\u3092\u66f8\u3044\u3066\u3057\u307e\u3063\u305f\u307b\u3046\u304c\u826f\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002 Athena\u306fANSI SQL\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u30af\u30a8\u30ea\u306e\u5b9f\u884c\u306b\u95a2\u3057\u3066\u306f\u7279\u306b\u6238\u60d1\u3046\u3068\u3053\u308d\u306f\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002 JDBC\u63a5\u7d9a\u306b\u3088\u308b\u30ea\u30e2\u30fc\u30c8\u304b\u3089\u306eSQL\u5b9f\u884c\u306b\u3082\u3057\u3063\u304b\u308a\u5bfe\u5fdc\u3055\u308c\u3066\u304a\u308a\u3001\u8a8d\u8a3c\u306b\u306f\u4ed6\u306eAPI\u3068\u540c\u3058\u3088\u3046\u306b\u3001IAM\u306eCredential\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 JDBC\u3055\u3048\u3042\u308c\u3070\u69d8\u3005\u306a\u30c4\u30fc\u30eb\u3068\u7e4b\u304c\u308b\uff01\u3053\u308c\u3067\u52dd\u3064\u308b\uff01\u3068\u601d\u3044\u306a\u304c\u3089\u624b\u5143\u306eApache Spark\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u305f\u306e\u3067\u3059\u304c\u3001Athena JDBC Driver\u306fPreparedStatement\u306b\u5bfe\u5fdc\u3057\u3066\u304a\u3089\u305a\u3001\u6b8b\u5ff5\u306a\u304c\u3089\u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002 API Gateway\u3084Lambda\u306a\u3069\u306e\u30b5\u30fc\u30d0\u30ec\u30b9\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u30d6\u30fc\u30e0\u3092\u5dfb\u304d\u3092\u8d8a\u3057\u305fAWS\u3067\u3059\u304c\u3001\u6a5f\u68b0\u5b66\u7fd2\u3084\u30d3\u30c3\u30b0\u30c7\u30fc\u30bf\u51e6\u7406\u3067\u306fBigQuery\u306e\u5727\u5012\u7684\u306a\u51e6\u7406\u80fd\u529b\u3092\u64c1\u3059\u308bGoogle\u306b\u3084\u3084\u5206\u304c\u3042\u308b\u3088\u3046\u306b\u611f\u3058\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n \u4eca\u5e74\u306ere:Invent \u3067\u306fAmazon Lex\u3001Amazon Polly\u3001Amazon Rekognition \u3068\u3044\u3046\u6a5f\u68b0\u5b66\u7fd23\u5144\u5f1f\u3082\u767a\u8868\u3055\u308c\u305f\u3053\u3068\u3067\u3059\u3057\u3001\u305d\u308c\u3089\u3082\u7d61\u3081\u3066Amazon Athena\u304c\u3069\u3093\u306a\u6210\u9577\u3092\u9042\u3052\u3066\u3044\u304f\u306e\u304b\u697d\u3057\u307f\u306b\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":" \u3053\u3093\u306b\u3061\u306f\u3001\u5bfa\u5ca1\u3067\u3059\u3002 \u4eca\u5e74\u3082AWS\u6700\u5927\u306e\u30a4\u30d9\u30f3\u30c8\u3001 re:Invent \u3067\u6ca2\u5c71\u306e\u65b0\u30b5\u30fc\u30d3\u30b9\u304c\u7d39\u4ecb\u3055\u308c\u307e\u3057\u305f\u3002
\n\u3053\u306e\u8a18\u4e8b\u306f TECHSCORE Advent Calendar 2016<\/a> \u306e6\u65e5\u76ee\u306e\u8a18\u4e8b\u3067\u3059\u3002<\/p>\n
\n\u4eca\u56de\u306f\u3001\u305d\u306e\u4e2d\u3067\u4e00\u756a\u6c17\u306b\u306a\u3063\u305fAmazon Athena\uff08\u30a2\u30c6\u30ca\uff09<\/a>\u3092\u3061\u3087\u3063\u3068\u3060\u3051\u3055\u308f\u3063\u3066\u307f\u305f\u611f\u60f3\u3092\u66f8\u304d\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\nAmazon Athena \u3068\u306f\uff1f<\/h2>\n
\n
\n\u307e\u3060\u6771\u4eac\u30ea\u30fc\u30b8\u30e7\u30f3\u3067\u306f\u5229\u7528\u3067\u304d\u307e\u305b\u3093\u304c\u3001\u30d0\u30fc\u30b8\u30cb\u30a2\u5317\u90e8\u3068\u30aa\u30ec\u30b4\u30f3\u30ea\u30fc\u30b8\u30e7\u30f3\u3067\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\u30b5\u30fc\u30d0\u30ec\u30b9\u3067\u30d5\u30eb\u30de\u30cd\u30fc\u30b8\u30c9<\/h2>\n
\n\u4eca\u307e\u3067AWS\u306e\u30d3\u30c3\u30b0\u30c7\u30fc\u30bf\u51e6\u7406\u30b5\u30fc\u30d3\u30b9\u306fEMR\u3084Redshift\u306a\u3069\u304c\u3042\u308a\u307e\u3057\u305f\u304c\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5c02\u6709\u578b\u306e\u305f\u3081\u904b\u7528\u306e\u624b\u9593\u3084\u30b3\u30b9\u30c8\u306f\u6c7a\u3057\u3066\u4f4e\u3044\u3082\u306e\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n
\n\u3057\u304b\u3057\u3001EMR\u306f\u30d6\u30fc\u30c8\u30b9\u30c8\u30e9\u30c3\u30d7\u306b\u6570\u5341\u5206\u306e\u6642\u9593\u304c\u304b\u304b\u308b\u305f\u3081\u3001\u4f7f\u3044\u305f\u3044\u3068\u304d\u306b\u3059\u3050\u30af\u30a8\u30ea\u5b9f\u884c\u3001\u3068\u3044\u3046\u308f\u3051\u306b\u306f\u3044\u304d\u307e\u305b\u3093\u3002\u3082\u3061\u308d\u3093EMR\u3092\u5e38\u6642\u8d77\u52d5\u3057\u3066\u304a\u3051\u3070\u826f\u3044\u306e\u3067\u3059\u304c\u3001\u305d\u306e\u5206\u30b3\u30b9\u30c8\u304c\u304b\u304b\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002
\nAthena\u3067\u3042\u308c\u3070\u3001\u30af\u30a8\u30ea\u5358\u4f4d\u3067\u306e\u8ab2\u91d1\u3068\u306a\u308b\u305f\u3081\u3001\u597d\u304d\u306a\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u30af\u30a8\u30ea\u3092\u5b9f\u884c\u3057\u3001\u4f7f\u3063\u305f\u5206\u3060\u3051\u6599\u91d1\u3092\u652f\u6255\u3048\u3070\u826f\u3044\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\u30c6\u30fc\u30d6\u30eb\u5b9a\u7fa9\u3068\u30af\u30a8\u30ea\u5b9f\u884c<\/h2>\n
\n\u30c6\u30fc\u30d6\u30eb\u5b9a\u7fa9\u306f\u7ba1\u7406\u753b\u9762\u306eCatalogManager\u3067\u8a2d\u5b9a\u3059\u308b\u304b\u3001SQL\u306eCREATE EXTERNAL TABLE \u6587\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u306b\u3088\u308a\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002
\n\u5bfe\u5fdc\u3057\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u306f\u4ee5\u4e0b\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n
\n\u4f8b\u3068\u3057\u3066\u3001\u30b5\u30f3\u30d7\u30eb\u306eELB\u30ed\u30b0\u30c6\u30fc\u30d6\u30eb\u306eCREATE TABLE\u6587\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\r\nCREATE EXTERNAL TABLE IF NOT EXISTS elb_logs_raw_native (\r\n request_timestamp string, \r\n elb_name string, \r\n request_ip string, \r\n request_port int, \r\n backend_ip string, \r\n backend_port int, \r\n request_processing_time double, \r\n backend_processing_time double, \r\n client_response_time double, \r\n elb_response_code string, \r\n backend_response_code string, \r\n received_bytes bigint, \r\n sent_bytes bigint, \r\n request_verb string, \r\n url string, \r\n protocol string, \r\n user_agent string, \r\n ssl_cipher string, \r\n ssl_protocol string ) \r\nROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.RegexSerDe'\r\n\r\nWITH SERDEPROPERTIES (\r\n 'serialization.format' = '1','input.regex' = '([^ ]*) ([^ ]*) ([^ ]*):([0-9]*) ([^ ]*):([0-9]*) ([.0-9]*) ([.0-9]*) ([.0-9]*) (-|[0-9]*) (-|[0-9]*) ([-0-9]*) ([-0-9]*) \\\\\\\"([^ ]*) ([^ ]*) (- |[^ ]*)\\\\\\\" (\\\"[^\\\"]*\\\") ([A-Z0-9-]+) ([A-Za-z0-9.-]*)$' ) \r\n\r\nLOCATION 's3:\/\/athena-examples\/elb\/raw\/';\r\n<\/pre>\n
\n\u30b9\u30ad\u30fc\u30de\u30c7\u30a3\u30b9\u30ab\u30d0\u30ea\u306a\u3069\u5b9a\u7fa9\u4f5c\u6210\u3092\u7c21\u7565\u5316\u3067\u304d\u308b\u6a5f\u80fd\u304c\u3042\u308c\u3070\u697d\u306b\u306a\u308b\u304b\u3068\u601d\u3046\u306e\u3067\u3001\u3053\u306e\u8fba\u308a\u306f\u4eca\u5f8c\u306e\u6539\u5584\u306b\u671f\u5f85\u3057\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u3002<\/p>\n
\nSQL\u3092\u66f8\u3044\u3066\u5b9f\u884c\u3059\u308b\u3060\u3051\u753b\u9762\u306b\u7d50\u679c\u304c\u8868\u793a\u3055\u308c\u3001\u30af\u30a8\u30ea\u4fdd\u5b58\u3084\u3001\u30af\u30a8\u30ea\u5c65\u6b74\u306e\u95b2\u89a7\u3001\u7d50\u679c\u306eCSV\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u306a\u3069\u3082\u53ef\u80fd\u3067\u3059\u3002
\nSQL\u306e\u7d30\u304b\u306a\u4ed5\u69d8\u306b\u3064\u3044\u3066\u306fPresto\u306eSQL<\/a>\u3092\u53c2\u8003\u306b\u3059\u308c\u3070\u3088\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\nJDBC\u63a5\u7d9a<\/h2>\n
\n\u63a5\u7d9a\u65b9\u6cd5\u306e\u8a73\u7d30\u306f\u4e0b\u8a18\u30da\u30fc\u30b8\u306b\u8a18\u8f09\u3055\u308c\u3066\u304a\u308a\u3001JDBC\u30c9\u30e9\u30a4\u30d0\u306e\u30ea\u30f3\u30af\u3082\u3053\u3061\u3089\u306b\u3042\u308a\u307e\u3059\u3002
\nhttps:\/\/docs.aws.amazon.com\/athena\/latest\/ug\/connect-with-jdbc.html<\/a><\/p>\n
\nBI\u30c4\u30fc\u30eb\u306a\u3069\u3068\u306e\u9023\u643a\u3092\u691c\u8a0e\u3059\u308b\u5834\u5408\u3001\u3053\u306e\u3042\u305f\u308a\u306b\u3064\u3044\u3066\u306f\u8003\u616e\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u305d\u3046\u3067\u3059\u306d\u3002<\/p>\n\u307e\u3068\u3081<\/h2>\n
\n\u3053\u306e\u8a18\u4e8b\u306f TECHSCORE Advent Calendar 2016 \u306e6\u65e5\u76ee\u306e\u8a18\u4e8b\u3067\u3059\u3002<\/p>\n
\u7d9a\u304d\u3092\u8aad\u3080...<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[239,18],"tags":[141,243,119],"_links":{"self":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/12613"}],"collection":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/comments?post=12613"}],"version-history":[{"count":29,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/12613\/revisions"}],"predecessor-version":[{"id":12773,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/12613\/revisions\/12773"}],"wp:attachment":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/media?parent=12613"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/categories?post=12613"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/tags?post=12613"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}