File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -808,14 +808,24 @@ def cleanup_stage(**context):
808808 dag = dags [i ]
809809 )
810810
811+ create_stage = SnowflakeOperator (
812+ task_id = 'create_stage' ,
813+ snowflake_conn_id = 'snowflake_default' ,
814+ sql = """
815+ CREATE STAGE IF NOT EXISTS BITCOIN_DATA.DATA.my_stage
816+ FILE_FORMAT = BITCOIN_DATA.DATA.json_format;
817+ """ ,
818+ dag = dags [i ]
819+ )
820+
811821# Create download and merge tasks for batches 1-4
812822for batch_num in range (1 , 5 ):
813823 prev_task = None
814824 dag = dags [batch_num ]
815825
816826 # Start with file format
817827 format_task = [task for task in dag .tasks if task .task_id == 'create_file_format' ][0 ]
818- prev_task = format_task
828+ stage_task = [ task for task in dag . tasks if task . task_id == 'create_stage' ][ 0 ]
819829
820830 # Create sequential download and merge for each metric
821831 for metric_name in batch_metrics [batch_num ]:
@@ -832,7 +842,7 @@ def cleanup_stage(**context):
832842 )
833843
834844 # Chain: previous_task >> download >> merge
835- prev_task >> download_task >> merge_task
845+ format_task >> stage_task >> download_task >> merge_task
836846 prev_task = merge_task
837847
838848
You can’t perform that action at this time.
0 commit comments