ashb commented on a change in pull request #14254: URL: https://github.com/apache/airflow/pull/14254#discussion_r589530274
########## File path: airflow/providers/microsoft/azure/transfers/sftp_to_wasb.py ########## @@ -0,0 +1,191 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +"""This module contains SFTP to Azure Blob Storage operator.""" +import os +from collections import namedtuple +from tempfile import NamedTemporaryFile +from typing import Any, Dict, List, Optional, Tuple + +from cached_property import cached_property Review comment: ```suggestion try: from functools import cached_property except ImportError: from cached_property import cached_property ``` ########## File path: airflow/providers/microsoft/azure/transfers/sftp_to_wasb.py ########## @@ -0,0 +1,191 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +"""This module contains SFTP to Azure Blob Storage operator.""" +import os +from collections import namedtuple +from tempfile import NamedTemporaryFile +from typing import Any, Dict, List, Optional, Tuple + +from cached_property import cached_property + +from airflow.exceptions import AirflowException +from airflow.models import BaseOperator +from airflow.providers.microsoft.azure.hooks.wasb import WasbHook +from airflow.providers.sftp.hooks.sftp import SFTPHook +from airflow.utils.decorators import apply_defaults + +WILDCARD = "*" +SftpFile = namedtuple('SftpFile', 'sftp_file_path, blob_name') + + +class SFTPToWasbOperator(BaseOperator): + """ + Transfer files to Azure Blob Storage from SFTP server. + + .. seealso:: + For more information on how to use this operator, take a look at the guide: + :ref:`howto/operator:SFTPToWasbOperator` + + :param sftp_source_path: The sftp remote path. This is the specified file path + for downloading the single file or multiple files from the SFTP server. + You can use only one wildcard within your path. The wildcard can appear + inside the path or at the end of the path. + :type sftp_source_path: str + :param container_name: Name of the container. + :type container_name: str + :param blob_prefix: Prefix to name a blob. + :type blob_prefix: str + :param sftp_conn_id: The sftp connection id. The name or identifier for + establishing a connection to the SFTP server. + :type sftp_conn_id: str + :param wasb_conn_id: Reference to the wasb connection. + :type wasb_conn_id: str + :param load_options: Optional keyword arguments that + `WasbHook.load_file()` takes. Review comment: ```suggestion ``WasbHook.load_file()`` takes. ``` ---------------------------------------------------------------- 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: [email protected]
