-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDDL_cloudfront_table.sql
62 lines (60 loc) · 1.81 KB
/
DDL_cloudfront_table.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
-- Create a table that points to your data in S3, using this query template, with your S3 location sub’d in.
-- This query also shows the fields you’ll have access to in your SQL queries
CREATE EXTERNAL TABLE IF NOT EXISTS `cloudfrontdb.cloudfront_may_october`(
`date_view` DATE,
`time_view` string,
`location` string,
`bytes` bigint,
`request_ip` string,
`method` string,
`host` string,
`uri` string,
`status` bigint,
`referrer` string,
`user_agent` string,
`query_string` string,
`cookie` string,
`result_type` string,
`request_id` string,
`host_header` string,
`request_protocol` string,
`request_bytes` bigint,
`time_taken` float,
`xforwarded_for` string,
`ssl_protocol` string,
`ssl_cipher` string,
`response_result_type` string,
`http_version` string,
`fle_status` bigint,
`fle_encrypted_fields` bigint,
`c_port` bigint,
`time_to_first_byte` float,
`x_edge_detailed_result_type` string,
`sc_content_type` bigint,
`sc_content_len` bigint,
`sc_range_start` bigint,
`sc_range_end` bigint)
PARTITIONED BY (
`year` string,
`month` string,
`day` string,
`hour` string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
STORED AS INPUTFORMAT
'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
's3://degruyter-cdnlogging-live-data/logs/'
TBLPROPERTIES (
'compressionType'='gzip',
'skip.header.line.count'='2',
'classification'='csv',
'areColumnsQuoted'='false',
'columnsOrdered'='true',
'commentCharacter'='#',
'delimiter'='\t',
'typeOfData'='file');
-- Load partitions afterwards
-- Load partitions – Runs the MSCK REPAIR TABLE table_name statement in the Athena Query Editor. This option is available only if the table has partitions.