-
Notifications
You must be signed in to change notification settings - Fork 16.2k
Description
Apache Airflow Provider(s)
common-sql
Versions of Apache Airflow Providers
The SQLExecuteQueryOperator extends BaseSQLOperator, which supports hook_params. However, the values in the extra_dejson field are not currently passed to hook_params within SQLExecuteQueryOperator.
This creates unnecessary redundancy when the same parameters need to be specified while creating operator. To reduce this duplication and improve consistency, the extra_dejson values should be passed to hook_params by default.
Expected Behavior:
Values in extra_dejson should be automatically added to hook_params unless explicitly overridden.
Apache Airflow version
2.10.5
Operating System
debian
Deployment
Astronomer
Deployment details
Local
What happened
No response
What you think should happen instead
No response
How to reproduce
-
Create a Google BigQuery connection in Airflow.
-
In the connection, set:
Backend connection has use_legacy_sql as False
{'/usr/local/airflow/include/service-account-key.json', 'num_retries': 5, 'is_anonymous': False, 'use_legacy_sql': False, 'priority': 'BATCH'}
-
In your DAG, use the
SQLExecuteQueryOperatorand reference this connection:SQLExecuteQueryOperator( task_id="run_query", sql="SELECT * FROM `project.dataset.table`", conn_id="my_bq_connection", ) -
Observe that
use_legacy_sqlis not picked up from the connection'sextra_dejson. -
You are forced to manually pass it like this:
SQLExecuteQueryOperator( task_id="run_query", sql="SELECT * FROM `project.dataset.table`", conn_id="my_bq_connection", hook_params={"use_legacy_sql": False} )
Anything else
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct

