Skip to content

Instantly share code, notes, and snippets.

@akrylysov
Created December 13, 2017 16:55
Show Gist options
  • Save akrylysov/f3b9004410d417604773ff646bb560dc to your computer and use it in GitHub Desktop.
Save akrylysov/f3b9004410d417604773ff646bb560dc to your computer and use it in GitHub Desktop.
AWS billing Athena schema
CREATE EXTERNAL TABLE `billing`(
`invoiceid` string,
`payeraccountid` string,
`linkedaccountid` string,
`recordtype` string,
`recordid` string,
`productname` string,
`rateid` string,
`subscriptionid` string,
`pricingplanid` string,
`usagetype` string,
`operation` string,
`availabilityzone` string,
`reservedinstance` string,
`itemdescription` string,
`usagestartdate` string,
`usageenddate` string,
`usagequantity` double,
`blendedrate` double,
`blendedcost` double,
`unblendedrate` double,
`unblendedcost` double,
`resourceid` string,
`user_name` string,
`user_project` string,
`user_role` string)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES (
'separatorChar' = ',',
'quoteChar' = '\"',
'escapeChar' = '\\'
)
STORED AS TEXTFILE
LOCATION 's3://TODO/'
TBLPROPERTIES ("skip.header.line.count"="1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment