示例#1
0
 def _check_inputs(self) -> None:
     if self.dest_gcs and not gcs_object_is_directory(self.dest_gcs):
         self.log.info(
             'Destination Google Cloud Storage path is not a valid '
             '"directory", define a path that ends with a slash "/" or '
             'leave it empty for the root of the bucket.')
         raise AirflowException(
             'The destination Google Cloud Storage path must end with a slash "/" or be empty.'
         )
示例#2
0
    def __init__(
        self,
        *,
        bucket,
        prefix='',
        delimiter='',
        aws_conn_id='aws_default',
        verify=None,
        gcp_conn_id='google_cloud_default',
        dest_gcs_conn_id=None,
        dest_gcs=None,
        delegate_to=None,
        replace=False,
        gzip=False,
        google_impersonation_chain: Optional[Union[str, Sequence[str]]] = None,
        **kwargs,
    ):

        super().__init__(bucket=bucket,
                         prefix=prefix,
                         delimiter=delimiter,
                         aws_conn_id=aws_conn_id,
                         **kwargs)

        if dest_gcs_conn_id:
            warnings.warn(
                "The dest_gcs_conn_id parameter has been deprecated. You should pass "
                "the gcp_conn_id parameter.",
                DeprecationWarning,
                stacklevel=3,
            )
            gcp_conn_id = dest_gcs_conn_id

        self.gcp_conn_id = gcp_conn_id
        self.dest_gcs = dest_gcs
        self.delegate_to = delegate_to
        self.replace = replace
        self.verify = verify
        self.gzip = gzip
        self.google_impersonation_chain = google_impersonation_chain

        if dest_gcs and not gcs_object_is_directory(self.dest_gcs):
            self.log.info(
                'Destination Google Cloud Storage path is not a valid '
                '"directory", define a path that ends with a slash "/" or '
                'leave it empty for the root of the bucket.')
            raise AirflowException(
                'The destination Google Cloud Storage path must end with a slash "/" or be empty.'
            )
示例#3
0
    def __init__(
        self,
        *,
        share_name: str,
        dest_gcs: str,
        directory_name: Optional[str] = None,
        prefix: str = '',
        wasb_conn_id: str = 'wasb_default',
        gcp_conn_id: str = 'google_cloud_default',
        delegate_to: Optional[str] = None,
        replace: bool = False,
        gzip: bool = False,
        google_impersonation_chain: Optional[Union[str, Sequence[str]]] = None,
        **kwargs,
    ):
        super().__init__(**kwargs)

        self.share_name = share_name
        self.directory_name = directory_name
        self.prefix = prefix
        self.wasb_conn_id = wasb_conn_id
        self.gcp_conn_id = gcp_conn_id
        self.dest_gcs = dest_gcs
        self.delegate_to = delegate_to
        self.replace = replace
        self.gzip = gzip
        self.google_impersonation_chain = google_impersonation_chain

        if dest_gcs and not gcs_object_is_directory(self.dest_gcs):
            self.log.info(
                'Destination Google Cloud Storage path is not a valid '
                '"directory", define a path that ends with a slash "/" or '
                'leave it empty for the root of the bucket.'
            )
            raise AirflowException(
                'The destination Google Cloud Storage path must end with a slash "/" or be empty.'
            )