raphaelauv commented on PR #35844:
URL: https://github.com/apache/airflow/pull/35844#issuecomment-1826453641
the "unload" I do
```
def unload_sql(sql_select_query: str, s3_export_path: str) -> str:
sql_select_query = sql_select_query.replace("'", "''")
return f"""
UNLOAD
('
{sql_select_query}
')
...
"""
def build_sql(date):
with open(os.path.join(UTILS_SQL_PATH, f"aaaaaaa.sql"), "r") as
sql_file:
s3_select_query = sql_file.read()
s3_path = "s3://aaaaaaaaaaaaa/{{ ds }}/"
return unload_sql(s3_select_query, s3_path)
build_sql_task = PythonOperator(
task_id="build_sql",
python_callable=build_sql,
op_kwargs={"date": "{{ds}}"})
run_sql_task = SQLExecuteQueryOperator(
task_id="toto",
conn_id="airflow_db",
sql="{{ task_instance.xcom_pull(task_ids='build_sql') }}"
)
build_sql_task >> run_sql_task
build_sql_task.as_setup()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]