-
Notifications
You must be signed in to change notification settings - Fork 0
/
spotify_dag.py
61 lines (53 loc) · 1.26 KB
/
spotify_dag.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from datetime import timedelta
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.utils.dates import days_ago
from datetime import datetime
from spotify_api_dataExtract import lambda_handler1
from tranform_load_function import album, artist, songs, lambda_handler2
default_args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': datetime(2023, 5, 13),
'email': ['airflow@example.com'],
'email_on_failure': False,
'email_on_retry': False,
'retries': 1,
'retry_delay': timedelta(minutes=1)
}
dag = DAG(
'spotify_dag',
default_args=default_args,
description='Our first DAG with ETL process!',
schedule_interval=timedelta(days=1),
)
task1 = PythonOperator(
task_id='complete_task1',
python_callable= lambda_handler1,
dag=dag,
)
task2 = PythonOperator(
task_id='complete_album',
python_callable= album,
dag=dag,
)
task3 = PythonOperator(
task_id='complete_artist',
python_callable= artist,
dag=dag,
)
task4 = PythonOperator(
task_id='complete_songs',
python_callable= songs,
dag=dag,
)
task5 = PythonOperator(
task_id='complete_task2',
python_callable= lambda_handler2,
dag=dag,
)
task1
task2
task3
task4
task5