pawelgrochowicz commented on code in PR #55219:
URL: https://github.com/apache/airflow/pull/55219#discussion_r2323452531
##########
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:
I'm adding the OpenLinage support to BigQueryToMsSQLOperator,
BigQueryToMySQLOperator and next to BigQueryToPostgresOperator. Initially, I'm
adding basic support to each of them, as they are not unified in terms of input
arguments. Then, I would like to refactor the code and, in the
BigQueryToSQLOperator (the base for all three), create a common version of the
code. As for now, as @GoogleBaseHook.fallback_to_default_project_id is
mostly used in hooks, I just reused what is theren
##########
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:
I'm adding the OpenLinage support to BigQueryToMsSQLOperator,
BigQueryToMySQLOperator and next to BigQueryToPostgresOperator. Initially, I'm
adding basic support to each of them, as they are not unified in terms of input
arguments. Then, I would like to refactor the code and, in the
BigQueryToSQLOperator (the base for all three), create a common version of the
code. As for now, as @GoogleBaseHook.fallback_to_default_project_id is
mostly used in hooks, I just reused what is there
--
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]