korolkevich commented on code in PR #37518:
URL: https://github.com/apache/airflow/pull/37518#discussion_r1498671418


##########
airflow/providers/google/cloud/transfers/s3_to_gcs.py:
##########
@@ -269,6 +269,7 @@ def transfer_files_async(self, files: list[str], gcs_hook: 
GCSHook, s3_hook: S3H
         self.defer(
             trigger=CloudStorageTransferServiceCreateJobsTrigger(
                 project_id=gcs_hook.project_id,
+                gcp_conn_id=self.gcp_conn_id,

Review Comment:
   @Taragolis Thank you. You are right. I've only done half the work providing 
the gcp_conn_id to CloudStorageTransferServiceCreateJobsTrigger, but nothing 
for when we get the error:
   ```
       self._client = StorageTransferServiceAsyncClient()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ```
   
   Could I ask you? Where do we need to check Google provider version?
   inside call get_conn
   ```
       def get_conn(self) -> StorageTransferServiceAsyncClient:
           """
           Return async connection to the Storage Transfer Service.
   
           :return: Google Storage Transfer asynchronous client.
           """
           if not self._client:
               self._client = StorageTransferServiceAsyncClient()
           return self._client
   
   ```
   
   and convert to something like this:
   
   ```
       def get_conn(self) -> StorageTransferServiceAsyncClient:
           """
           Return async connection to the Storage Transfer Service.
   
           :return: Google Storage Transfer asynchronous client.
           """
           if not self._client:
               try:
                   from airflow.providers.google import __version__
   
                   if Version(__version__) >= Version("10.15.0"):
                       credentials = (await 
self.get_sync_hook()).get_credentials()
                       self._client = StorageTransferServiceAsyncClient(
                           credentials=credentials,
                           client_info=CLIENT_INFO,
                       )
                   else:
                       self._client = StorageTransferServiceAsyncClient()
                       warnings.warn(
                           "Getting credentials from the environment has been 
deprecated. "
                           "You should pass gcp_conn_id as parameter.",
                           AirflowProviderDeprecationWarning,
                           stacklevel=2,
                       )
               except ImportError:  # __version__ was added in 10.1.0, so this 
means it's < 10.3.0
                   self._client = StorageTransferServiceAsyncClient()
                   warnings.warn(
                       "Getting credentials from the environment has been 
deprecated. "
                       "You should pass gcp_conn_id as parameter.",
                       AirflowProviderDeprecationWarning,
                       stacklevel=2,
                   )
           return self._client
   ```
   
   or do we need to place this warning elsewhere?



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