From fd8089827499cd5fefafd6fc34335efe31549f63 Mon Sep 17 00:00:00 2001 From: Laysa de Sousa Bitencourt Date: Fri, 19 Apr 2024 11:56:13 -0300 Subject: [PATCH] type(dag_run.execution_date) --- dags/stellar_etl_airflow/test_sources.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dags/stellar_etl_airflow/test_sources.py b/dags/stellar_etl_airflow/test_sources.py index 4f9bcceb..674f1e0f 100644 --- a/dags/stellar_etl_airflow/test_sources.py +++ b/dags/stellar_etl_airflow/test_sources.py @@ -40,13 +40,16 @@ def get_from_combinedExport(**context): gcs_hook = GCSHook(google_cloud_storage_conn_id="google_cloud_storage_default") for dag_run in execution_dates: - dag_run.execution_date = dag_run.execution_date.replace(" ", "T") - print(dag_run.execution_date) + execution_date_str = dag_run.execution_date.strftime( + "%Y-%m-%d %H:%M:%S%z" + ).replace(" ", "T") + print(f" EM STRING É:{execution_date_str}") + print(type(dag_run.execution_date)) # Download the file and get its content, it runs 47 times day 16th of april file_content = gcs_hook.download( bucket_name="us-central1-test-hubble-2-5f1f2dbf-bucket", - object_name="logs/dag_id=history_archive_with_captive_core_combined_export/run_id=scheduled__{dag_run.execution_date}/task_id=export_all_history_task/attempt=1.log", + object_name="logs/dag_id=history_archive_with_captive_core_combined_export/run_id=scheduled__{execution_date_str}/task_id=export_all_history_task/attempt=1.log", ) # Decode the bytes object to a string