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

   ### Apache Airflow version
   
   Other Airflow 2 version (please specify below)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   2.7.3
   
   ### What happened?
   
   `SqlSensor` from `airflow.providers.common.sql.sensors.sql` doesn't support 
`BigQuery` when connection type is not `gcpbigquery`, resulting:
   ```
   airflow.exceptions.AirflowException: The connection type is not supported by 
SqlSensor. The associated hook should be a subclass of `DbApiHook`. Got 
GoogleBaseHook
   ```
   
   Although `gcpbigquery` connection doesn't have an option to keep JSON 
private key with service account.
   
   ### What you think should happen instead?
   
   `SqlSensor` determines type of hook 
[here](https://github.com/apache/airflow/blob/f1243537838516b8bb8156130bc001595bfbeb01/airflow/providers/common/sql/sensors/sql.py#L85)
 using connection type and checking `DbApiHook` inheritance.
   
   I can't use `SqlSensor` with `google_cloud_platform` connection defined, 
having a JSON private key and at the same time `gcpbigquery` connection type 
doesn't allow to keep private key. Though `BigQueryHook` itself 
[support](https://github.com/apache/airflow/blob/13b0930bf45faece076ef1b0c4e6fd14f2b17e16/airflow/providers/google/cloud/hooks/bigquery.py#L104C9-L104C20)
 `google_cloud_platform` connection. 
   
   I have tried bypassing connection via `hook_params` like this:
   ```
   SqlSensor(
      task_id="bq_sensor",
      conn_id="fake gcpbigquery connection",
      hook_params={
         "gcp_conn_id": "real google_cloud_platform  connection with PK",
         "location": "US"
      },
   )
   ```
   but it prevented 
[here](https://github.com/apache/airflow/blob/f1243537838516b8bb8156130bc001595bfbeb01/airflow/models/connection.py#L374)
 with message: 
   ```
   TypeError: airflow.providers.google.cloud.hooks.bigquery.BigQueryHook() got 
multiple values for keyword argument 'gcp_conn_id'
   ```
   
   Is there any other option to use `SqlSensor` with google service account?
   
   ### How to reproduce
   
   See about explanation.
   
   ### Operating System
   
   Mac
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-google 10.6.0
   
   ### Deployment
   
   Astronomer
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] 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