66from airflow .decorators import dag , task , task_group
77from orchestrate .utils import datacoves_utils
88
9- from datahub_airflow_plugin .entities import Dataset
9+ from fivetran_provider_async .operators import FivetranOperator
10+ from fivetran_provider_async .sensors import FivetranSensor
11+ from airflow .providers .airbyte .operators .airbyte import AirbyteTriggerSyncOperator
1012
1113@dag (
1214 doc_md = __doc__ ,
@@ -28,47 +30,32 @@ def daily_loan_run():
2830 tooltip = "Airbyte Extract and Load"
2931 )
3032 def extract_and_load_airbyte ():
31-
3233 # Extact and load
33- @task
34- def sync_airbyte ():
35- from airflow .providers .airbyte .operators .airbyte import AirbyteTriggerSyncOperator
36- return AirbyteTriggerSyncOperator (
37- task_id = "country_populations_datacoves_snowflake" ,
38- connection_id = "ac02ea96-58a1-4061-be67-78900bb5aaf6" ,
39- airbyte_conn_id = "airbyte_connection" ,
40- ).execute ({})
41-
42- sync_airbyte ()
34+ sync_airbyte = AirbyteTriggerSyncOperator (
35+ task_id = "country_populations_datacoves_snowflake" ,
36+ connection_id = "ac02ea96-58a1-4061-be67-78900bb5aaf6" ,
37+ airbyte_conn_id = "airbyte_connection" ,
38+ )
4339
4440
4541 @task_group (
4642 group_id = "extract_and_load_fivetran" ,
4743 tooltip = "Fivetran Extract and Load"
4844 )
4945 def extract_and_load_fivetran ():
50-
51- @task
52- def trigger_fivetran ():
53- from fivetran_provider_async .operators import FivetranOperator
54- return FivetranOperator (
55- task_id = "datacoves_snowflake_google_analytics_4_trigger" ,
56- fivetran_conn_id = "fivetran_connection" ,
57- connector_id = "speak_menial" ,
58- wait_for_completion = False ,
59- ).execute ({})
60-
61- @task
62- def sensor_fivetran ():
63- from fivetran_provider_async .sensors import FivetranSensor
64- return FivetranSensor (
65- task_id = "datacoves_snowflake_google_analytics_4_sensor" ,
66- fivetran_conn_id = "fivetran_connection" ,
67- connector_id = "speak_menial" ,
68- poke_interval = 60 ,
69- ).poke ({})
70-
71- trigger_fivetran () >> sensor_fivetran ()
46+ trigger_fivetran = FivetranOperator (
47+ task_id = "datacoves_snowflake_google_analytics_4_trigger" ,
48+ fivetran_conn_id = "fivetran_connection" ,
49+ connector_id = "speak_menial" ,
50+ wait_for_completion = False ,
51+ )
52+ sensor_fivetran = FivetranSensor (
53+ task_id = "datacoves_snowflake_google_analytics_4_sensor" ,
54+ fivetran_conn_id = "fivetran_connection" ,
55+ connector_id = "speak_menial" ,
56+ poke_interval = 60 ,
57+ )
58+ trigger_fivetran >> sensor_fivetran
7259
7360
7461 @task_group (
@@ -93,7 +80,7 @@ def load_loans_data():
9380 connection_id = "main"
9481 )
9582 def transform ():
96- return "dbt build -s 'tag:daily_run_airbyte+ tag:daily_run_fivetran+ -t prd '"
83+ return "dbt build -s 'tag:daily_run_airbyte+ tag:daily_run_fivetran+'"
9784
9885
9986 # Post transformation tasks
0 commit comments