You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/12/14 05:49:29 UTC

[GitHub] [airflow] RosterIn commented on a change in pull request #11332: SnowflakeToS3Operator

RosterIn commented on a change in pull request #11332:
URL: https://github.com/apache/airflow/pull/11332#discussion_r542127785



##########
File path: airflow/providers/amazon/aws/transfers/snowflake_to_s3.py
##########
@@ -0,0 +1,150 @@
+#
+# 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.
+"""Transfers data from Snowflake into a S3 Bucket."""
+from typing import List, Optional
+
+from airflow.models import BaseOperator
+from airflow.providers.snowflake.hooks.snowflake import SnowflakeHook
+from airflow.utils.decorators import apply_defaults
+
+
+class SnowflakeToS3Operator(BaseOperator):
+    """
+    UNLOAD a query or a table from Snowflake to S3. It is not necessary a conn to S3 because
+    Snowflake handles it. You have to follow one of the setups in:
+    https://docs.snowflake.com/en/user-guide/data-load-s3-config.html
+
+    :param stage: Copy the data into a Snowflake Stage. This allows you to use the method
+        'Configuring AWS IAM User Credentials' for unloading data to s3. If this is true,
+        s3_bucket and file_format are not necessaries.
+    :type stage: bool
+    :param warehouse: reference to a specific snowflake warehouse to override the one in conn
+    :type warehouse: str
+    :param database: reference to a specific snowflake database to override the one in conn
+    :type warehouse: str
+    :param s3_bucket: reference to a specific S3 bucket where the data will be saved. For using it, you
+        should have done the one-time setup 'Configuring a Snowflake Storage Integration'
+    :type s3_bucket: str
+    :param s3_key: reference to a specific S3 key within the previous bucket
+    :type s3_key: str
+    :param file_format: can be either a previous file format created in Snowflake
+        or hardcoded one like ``type = csv field_delimiter = ',' skip_header = 1``
+    :type file_format: str
+    :param query_or_table: query or full table to unload. If table, it must include the schema like
+        ``schema.table`

Review comment:
       ```suggestion
           `schema.table`
   ```




----------------------------------------------------------------
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:
users@infra.apache.org