Skip to content

Instantly share code, notes, and snippets.

@super-eben
super-eben / test_superquery_operator.py
Created March 12, 2019 07:21
Test DAG for the SuperQueryOperator
from datetime import timedelta, datetime
import json
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
from airflow.operators.mysql_operator import MySqlOperator
from airflow.operators import DynamodbToBigqueryOperator
from airflow.operators import SuperQueryOperator
from airflow.hooks.mysql_hook import MySqlHook
@super-eben
super-eben / superquery_operator.py
Last active April 5, 2019 15:24
SuperQuery operator for Apache Airflow
import uuid
import logging
import pandas as pd
import json
from contextlib import closing
import sys
from airflow.exceptions import AirflowException
from airflow.models import BaseOperator
from airflow.plugins_manager import AirflowPlugin
@super-eben
super-eben / BQcanRunThis.sql
Created October 15, 2018 15:22
BigQuery can run this query
WITH theQueryResult AS (
SELECT
user_email,
cost
FROM
mytable
WHERE
DATE(_PARTITIONTIME) >= "2018-07-01"
AND DATE(_PARTITIONTIME) <= "2018-08-30"
AND cost > 0
@super-eben
super-eben / BQcannotRunThis.sql
Created October 15, 2018 15:17
A query that BigQuery can't run
SELECT
user_email
cost
FROM
mytable
WHERE
DATE(_PARTITIONTIME) >= "2018-07-01"
AND DATE(_PARTITIONTIME) <= "2018-08-01"
AND cost > 0
AND cost IS NOT NULL