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
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 |
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 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 |
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
WITH theQueryResult AS ( | |
SELECT | |
user_email, | |
cost | |
FROM | |
mytable | |
WHERE | |
DATE(_PARTITIONTIME) >= "2018-07-01" | |
AND DATE(_PARTITIONTIME) <= "2018-08-30" | |
AND cost > 0 |
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
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 |