Skip to content

Instantly share code, notes, and snippets.

class XComEnabledAWSAthenaOperator(AWSAthenaOperator):
def execute(self, context):
super(XComEnabledAWSAthenaOperator, self).execute(context)
# just so that this gets `xcom_push`(ed)
return self.query_execution_id
export AIRFLOW_CONN_AWS_DEFAULT="s3://$AWS_CLIENT_ID:$AWS_CLIENT_SECRET@my-bucket?region_name=$AWS_REGION"
from airflow.models import DAG
from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
from datetime import datetime
with DAG(dag_id='simple_s3_copy',
schedule_interval=None,
start_date=datetime(2019, 6, 7)) as dag:
copy_file_over = S3FileTransformOperator(
task_id='copy_file_over',
@mrshu
mrshu / simple_templated_athena_query.py
Last active June 7, 2019 19:29
Simple Templated Athena Query
from airflow.models import DAG
from airflow.contrib.operators.aws_athena_operator import AWSAthenaOperator
from datetime import datetime
with DAG(dag_id='simple_athena_query',
schedule_interval=None,
start_date=datetime(2019, 5, 21)) as dag:
run_query = AWSAthenaOperator(
task_id='run_query',
@mrshu
mrshu / simple_athena_query.py
Last active June 20, 2019 16:35
Simple Athena Query
from airflow.models import DAG
from airflow.contrib.operators.aws_athena_operator import AWSAthenaOperator
from datetime import datetime
with DAG(dag_id='simple_athena_query',
schedule_interval=None,
start_date=datetime(2019, 5, 21)) as dag:
run_query = AWSAthenaOperator(
task_id='run_query',
@mrshu
mrshu / list_available_packages.py
Created February 4, 2019 15:49
Python list available packages
import pkg_resources
installed_packages = pkg_resources.working_set
for package in sorted(installed_packages, lambda x: x.key):
print "{}=={}".format(package.key, package.version)
@mrshu
mrshu / aws_glue_python_shell_installed_packages.txt
Created February 1, 2019 09:22
AWS Glue Python Shell -- pre-installed packages
awscli==1.14.45
boto3==1.5.35
botocore==1.8.49
colorama==0.3.7
docutils==0.14
futures==3.2.0
jmespath==0.9.3
numpy==1.14.0
pandas==0.22.0
pip==9.0.1
@mrshu
mrshu / athena_dbt.md
Last active November 28, 2018 13:24
AWS Athena `dbt` information sheet
  1. What options are there for connecting to the warehouse? Eg: ODBC, a python module, etc

  2. Is there a consensus around which of the options in #1 is the most featureful/best supported/most mature/etc option?

  • It would most probably be PyAthena, as it does not have any other non-pythonic requirements.
# Example xorg.conf.d snippet that assigns the touchpad driver
# to all touchpads. See xorg.conf.d(5) for more information on
# InputClass.
# DO NOT EDIT THIS FILE, your distribution will likely overwrite
# it when updating. Copy (and rename) this file into
# /etc/X11/xorg.conf.d first.
# Additional options may be added in the form of
# Option "OptionName" "value"
#
Section "InputClass"
@mrshu
mrshu / html5-audio.html
Created January 31, 2013 17:25
Simple example of usage of HTML5 audio tag
<!DOCTYPE html>
<html>
<head>
<script>
var player = document.getElementById("player");
player.play();
</script>
</head>
<body>
<audio id="player">