AngryHelper commented on a change in pull request #19852: URL: https://github.com/apache/airflow/pull/19852#discussion_r767298864
########## File path: airflow/providers/sftp/operators/sftp_batch.py ########## @@ -0,0 +1,184 @@ +# +# 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 Batch operator.""" +import os +import re +from pathlib import Path +from typing import Any, List, Union + +from paramiko.sftp_client import SFTPClient + +from airflow.exceptions import AirflowException +from airflow.models import BaseOperator +from airflow.providers.sftp.operators.sftp import SFTPOperation, _check_conn, _make_intermediate_dirs + + +class SFTPBatchOperator(BaseOperator): + """ + SFTPOperator for transferring files from remote host to local or vice a versa. + This operator uses ssh_hook to open sftp transport channel that serve as basis + for file transfer. + :param ssh_hook: predefined ssh_hook to use for remote execution. + Either `ssh_hook` or `ssh_conn_id` needs to be provided. + :type ssh_hook: airflow.providers.ssh.hooks.ssh.SSHHook + :param ssh_conn_id: :ref:`ssh connection id<howto/connection:ssh>` + from airflow Connections. `ssh_conn_id` will be ignored if `ssh_hook` + is provided. + :type ssh_conn_id: str + :param remote_host: remote host to connect (templated) + Nullable. If provided, it will replace the `remote_host` which was + defined in `ssh_hook` or predefined in the connection of `ssh_conn_id`. + :type remote_host: str + :param local_path: local folder path to get or put. (templated) + :type local_path: str or list + :param remote_path: remote folder path to get or put. (templated) + :type remote_path: str or list + :param regexp_mask: regexp mask for file match in local_folder or remote_folder to get or put. (templated) Review comment: done -- 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]
