VladaZakharova commented on code in PR #55219:
URL: https://github.com/apache/airflow/pull/55219#discussion_r2321529448
##########
providers/google/src/airflow/providers/google/cloud/transfers/bigquery_to_mysql.py:
##########
@@ -76,5 +86,73 @@ def __init__(
)
self.mysql_conn_id = mysql_conn_id
- def get_sql_hook(self) -> MySqlHook:
+ @cached_property
+ def mysql_hook(self) -> MySqlHook:
return MySqlHook(schema=self.database,
mysql_conn_id=self.mysql_conn_id)
+
+ def get_sql_hook(self) -> MySqlHook:
+ return self.mysql_hook
+
+ @GoogleBaseHook.fallback_to_default_project_id
+ def get_source_project_dataset_table(self, project_id: str =
PROVIDE_PROJECT_ID) -> str:
+ return project_id
+
+ def execute(self, context):
+ # Set source_project_dataset_table here, after hooks are initialized
and project_id is available
+ project_id = self.bigquery_hook.project_id
Review Comment:
is there a reason you want to get project_id from hook specifically and not
from self of the operator?
##########
providers/google/src/airflow/providers/google/cloud/transfers/bigquery_to_mysql.py:
##########
@@ -76,5 +86,73 @@ def __init__(
)
self.mysql_conn_id = mysql_conn_id
- def get_sql_hook(self) -> MySqlHook:
+ @cached_property
+ def mysql_hook(self) -> MySqlHook:
return MySqlHook(schema=self.database,
mysql_conn_id=self.mysql_conn_id)
+
+ def get_sql_hook(self) -> MySqlHook:
+ return self.mysql_hook
+
+ @GoogleBaseHook.fallback_to_default_project_id
+ def get_source_project_dataset_table(self, project_id: str =
PROVIDE_PROJECT_ID) -> str:
+ return project_id
Review Comment:
I don't quite get this function's purpose :)
Does it not just return project_id? in general you can use this decorator
@GoogleBaseHook.fallback_to_default_project_id to get project_id
--
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]