You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/06/28 16:28:25 UTC

[GitHub] [airflow] creyesp commented on issue #5478: [AIRFLOW-4849] Add gcp_conn_id to cloudsqldatabehook class to use correctly CloudSqlProxyRunner class

creyesp commented on issue #5478: [AIRFLOW-4849] Add gcp_conn_id to cloudsqldatabehook class to use correctly CloudSqlProxyRunner class
URL: https://github.com/apache/airflow/pull/5478#issuecomment-506795731
 
 
   @kaxil I wrote in the description that I reviewed the issue [#5314](https://github.com/apache/airflow/pull/5314) but the problem is the following 
   - CloudSqlQueryOperator set the an attribute called [cloudsql_db_hook](https://github.com/apache/airflow/blob/750cb7a1a08a71b63af4ea787ae29a99cfe0a8d9/airflow/contrib/operators/gcp_sql_operator.py#L774), an object of CloudSqlDatabaseHook class, without add **gcp_conn_id** parameter (only add **gcp_cloudsql_conn_id**). 
   - When CloudSqlDatabaseHook call [get_sqlproxy_runner()](https://github.com/apache/airflow/blob/750cb7a1a08a71b63af4ea787ae29a99cfe0a8d9/airflow/contrib/hooks/gcp_sql_hook.py#L959) method, it create a object of CloudSqlProxyRunner() with a **gcp_cloudsql_conn_id** parameter instead of **gcp_conn_id**
   - When  CloudSqlProxyRunner() retrieve credential [_get_credential_parameters()](https://github.com/apache/airflow/blob/750cb7a1a08a71b63af4ea787ae29a99cfe0a8d9/airflow/contrib/hooks/gcp_sql_hook.py#L488) try to find a KEY_PATH or KEYFILE_DICT but a **gcp_cloudsql_conn_id** doesn't have this parameters and return a [empty list](https://github.com/apache/airflow/blob/750cb7a1a08a71b63af4ea787ae29a99cfe0a8d9/airflow/contrib/hooks/gcp_sql_hook.py#L508) 
   
   This PR add a **gcp_conn_id** attribute on  CloudSqlDatabaseHook class and pass it attribute to CloudSqlProxyRunner to let get it a google cloud credential and activete a _cloud_sql_proxy_ correctly. 
   
   I should change description name to be more clear about the problem.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services