This file contains 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
import json | |
import inquirer | |
import boto3 | |
import os | |
import sys | |
import subprocess | |
def select_account(): |
This file contains 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
# Byte-compiled / optimized / DLL files | |
__pycache__/ | |
*.py[cod] | |
*$py.class | |
# C extensions | |
*.so | |
# Distribution / packaging | |
.Python |
This file contains 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
import psycopg2 | |
# Functions for reading scripts | |
class ScriptReader(object): | |
@staticmethod | |
def get_script(path): | |
return open(path, 'r').read() | |
# Utils for messages |
This file contains 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
#!/usr/bin/env python3 | |
"""List S3 bucket objects in parallel. | |
This module contains a parallel implementation of S3 list_objects_v2() | |
API call. The implementation lists objects under every distinct prefix | |
in parallel. Hence, a speedup is achieved if objects are spread under | |
multiple distinct prefixes. | |
""" | |
import argparse |
This file contains 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
import boto3 | |
dynamodb = boto3.resource('dynamodb', 'region-name') | |
table = dynamodb.Table('table-name') | |
scan = table.scan( | |
ProjectionExpression='#k', | |
ExpressionAttributeNames={ | |
'#k': 'name' | |
} |
This file contains 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
#!/usr/bin/env python | |
# vim: set fileencoding=utf8 : | |
``` | |
$ pip install -U boto3 retrying | |
$ export AWS_DEFAULT_PROFILE=test | |
$ cat foo.sql | |
select count(*) | |
from bar | |
$ python athena.py foo.sql | |
$ ls -1 |
This file contains 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
-- | |
-- This will register the "planet" table within your AWS account | |
-- | |
CREATE EXTERNAL TABLE planet ( | |
id BIGINT, | |
type STRING, | |
tags MAP<STRING,STRING>, | |
lat DECIMAL(9,7), | |
lon DECIMAL(10,7), | |
nds ARRAY<STRUCT<ref: BIGINT>>, |