Skip to content

Instantly share code, notes, and snippets.

rioner rioner

Block or report user

Report or block rioner

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View try_new
try:
# 処理
expect client.expections.ClientError as e:
pass
View try_old
try:
# 処理
expect Exception as e:
if str(e) = 'エラー文':
pass
else:
print(e)
View sort_partition
SELECT * FROM "データベース名"."テーブル名"
where
dt = '2018/10/01'
order by numbytes desc limit 10
View create_partition
ALTER TABLE ap_northeast_1
ADD PARTITION (dt='2018/10/01')
location 's3://バケット名/AWSLogs/アカウント番号/vpcflowlogs/ap-northeast-1/2018/10/01';
View create_table
CREATE EXTERNAL TABLE IF NOT EXISTS データベース名.テーブル名 (
version int,
account string,
interfaceid string,
sourceaddress string,
destinationaddress string,
sourceport int,
destinationport int,
protocol int,
numpackets int,
View create_database
CREATE DATABASE データベース名
@rioner
rioner / lambda_function.py
Last active Oct 11, 2018
VPC Flow LogsをAthenaで分析できるようにpartitionを区切るやつ
View lambda_function.py
import boto3
import datetime
def lambda_handler(event, context):
# タイムゾーンの生成
JST = timezone(timedelta(hours=+9), 'JST')
now = datetime.now(JST)
print(now.strftime("%Y/%m/%d")) #2018/10/02
You can’t perform that action at this time.