SHARE
TWEET

Untitled

a guest Jun 17th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import airflow
  2. from airflow.operators.bash_operator import BashOperator
  3. from airflow import DAG
  4. from airflow.hooks.postgres_hook import PostgresHook
  5. from airflow.operators.bash_operator import BashOperator
  6. from airflow.operators.python_operator import PythonOperator
  7. from airflow.operators.postgres_operator import PostgresOperator
  8. import os
  9. from datetime import datetime, timedelta
  10. import numpy as np
  11.  
  12.  
  13. default_args = {
  14.             "owner": "airflow",
  15.             "depends_on_past": False,
  16.             "start_date": airflow.utils.dates.days_ago(1),
  17.             "email": ["airflow@airflow.com"],
  18.             "email_on_failure": False,
  19.             "email_on_retry": False,
  20.             "retries": 1,
  21.             "retry_delay": timedelta(minutes=1),
  22.             }
  23.  
  24. dag = DAG("Score_update", default_args=default_args, schedule_interval='3,33 * * * *',template_searchpath = ['/root/airflow/sql/'],max_active_runs=1)
  25.  
  26.  
  27. updateOp = PostgresOperator(
  28.                     task_id='Refresh_DailyScore',
  29.                     postgres_conn_id='postgress_sophi',
  30.                     sql='Score.sql',
  31.                     params={'name':'alpa'},
  32.                     dag=dag)
  33.  
  34. updateOp
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top