This file contains hidden or 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
HiveToMySqlTransfer( | |
task_id='data_to_mysql_transfer', | |
sql="SELECT * FROM robert.dim_bitcoin_revenue WHERE ds = '{{ ds }}'", | |
mysql_conn_id='robert_mysql', | |
mysql_table='dim_bitcoin_revenue', | |
hiveserver2_conn_id='hiveserver2_silver', | |
dag=dag) |
This file contains hidden or 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
template = """ | |
SELECT | |
SUM(m_bitcoin_trade_revenue) AS m_revenue | |
FROM | |
robert.fct_bitcoin_revenue | |
WHERE | |
ds = '{{ ds }}' | |
""" | |
HiveOperator( |
This file contains hidden or 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
NamedHivePartitionSensor( | |
task_id='waiting_for_my_awesome_hive_table', | |
partition_names=['robert.fct_bitcoin_revenue'], | |
dag=dag | |
) |
This file contains hidden or 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
""" | |
A DAG docstring might be a good way to explain at a high level | |
what problem space the DAG is looking at. | |
Links to design documents, upstream dependencies etc | |
are highly recommended. | |
""" | |
from datetime import datetime, timedelta | |
from airflow.models import DAG # Import the DAG class | |
from airflow.operators.sensors import NamedHivePartitionSensor | |
from airflow.operators.hive_operator import HiveOperator |
This file contains hidden or 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
""" | |
A DAG docstring might be a good way to explain at a high level | |
what problem space the DAG is looking at. | |
Links to design documents, upstream dependencies etc | |
are highly recommended. | |
""" | |
from datetime import datetime, timedelta | |
from airflow.models import DAG # Import the DAG class | |
from airflow.operators.bash_operator import BashOperator | |
from airflow.operators.python_operator import PythonOperator |
This file contains hidden or 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
""" | |
A DAG definition file in Airflow, written in Python. | |
""" | |
from datetime import datetime, timedelta | |
from airflow.models import DAG # Import the DAG class | |
from airflow.operators.bash_operator import BashOperator | |
from airflow.operators.sensors import TimeDeltaSensor | |
default_args = { | |
'owner': 'you', |
This file contains hidden or 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
def fit(X_train, y_train): | |
import multiprocessing | |
from ml_helpers.sklearn_extensions import DenseMatrixConverter | |
from ml_helpers.data import split_records | |
from xgboost import XGBRegressor | |
global model | |
model = {} | |
n_subset = N_EXAMPLES |
This file contains hidden or 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
transforms = [] | |
transforms.append( | |
('select_binary', ColumnSelector(features=binary)) | |
) | |
transforms.append( | |
('numeric', ExtendedPipeline([ | |
('select', ColumnSelector(features=numeric)), | |
('impute', Imputer(missing_values='NaN', strategy='mean', axis=0)), |
This file contains hidden or 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
source: { | |
type: hive | |
query:""" | |
SELECT | |
id_listing as listing | |
, dim_city as city | |
, dim_country as country | |
, dim_is_active as is_active | |
, CONCAT(ds, ' 23:59:59.999') as ts | |
FROM |
This file contains hidden or 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
Object.keys(window.calendarMap).forEach(function(key){ | |
document.getElementById(key) | |
.addEventListener(‘click’, function(){ | |
makeCalendar(key); | |
}); | |
}); | |
// ... a bunch of D3 code to set up my calendar visualization ... // | |
function makeCalendar(eventType) { |