kandharvishnu opened a new issue, #49273:
URL: https://github.com/apache/airflow/issues/49273

   ### 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.1
   
   ### Operating System
   
   debian
   
   ### Deployment
   
   Astronomer
   
   ### Deployment details
   
   Local
   
   ### What happened
   
   _No response_
   
   ### What you think should happen instead
   
   _No response_
   
   ### How to reproduce
   
   1. Create a **Google BigQuery** connection in Airflow.
       
   2. In the connection, set:
       
   
![Image](https://github.com/user-attachments/assets/8f36eac5-1e99-4cb6-ae26-3b555ad46335)
   
   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'}
   ```
       
   
![Image](https://github.com/user-attachments/assets/e5144531-0342-4520-9733-4ebb356f51f4)
   
   3. In your DAG, use the `SQLExecuteQueryOperator` and reference this 
connection:
       
       ```
       SQLExecuteQueryOperator(
           task_id="run_query",
           sql="SELECT * FROM `project.dataset.table`",
           conn_id="my_bq_connection",
       )
       ```
       
   4. Observe that `use_legacy_sql` is **not** picked up from the connection's 
`extra_dejson`.
       
   5. You are forced to manually pass it like this:
       
       ```python
       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?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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]

Reply via email to