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



##########
File path: airflow/providers/amazon/aws/transfers/snowflake_to_s3.py
##########
@@ -0,0 +1,82 @@
+"""
+Transfers data from Snowflake into a S3 Bucket.
+"""
+from typing import List, Optional, Union
+from airflow.models import BaseOperator
+from airflow.utils.decorators import apply_defaults
+from airflow.providers.snowflake.hooks.snowflake import SnowflakeHook
+
+
+class SnowflakeToS3Operator(BaseOperator):
+    """
+    UNLOAD a query or a table from Snowflake to S3
+    :param schema: reference to a specific schema in snowflake database
+    :type schema: str
+    :param table: reference to a specific table in snowflake database
+    :type table: str
+    :param s3_bucket: reference to a specific S3 bucket where the data will be 
saved
+    :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 console or hardcoded one like
+        ``type = csv
+         field_delimiter = ','
+         skip_header = 1
+         compression=None``
+    :type file_format: str
+    :param sql: optional parameter to unload a customized query instead an 
entire table
+    :type sql: str
+    :param snowflake_conn_id: reference to a specific snowflake database
+    :type snowflake_conn_id: str
+    :param unload_options: reference to a str of UNLOAD options. For instance, 
a valid string would be:
+          ``SINGLE=TRUE
+           MAX_FILE_SIZE = 5368709119
+           OVERWRITE = TRUE``
+    :type unload_options: str
+    """
+
+    template_fields = ('s3_key', 's3_bucket', 'sql', 'table', 
'snowflake_conn_id',)
+    template_ext = ('.sql',)
+    ui_color = '#ededed'
+
+    @apply_defaults
+    def __init__(
+        self,
+        s3_bucket: str,
+        s3_key: str,
+        file_format: str,
+        schema: Optional[str] = None,
+        table: Optional[str] = None,
+        sql: Optional[str] = None,
+        snowflake_conn_id: str = "snowflake_default",
+        unload_options: Optional[str] = None,
+        autocommit: bool = True,
+        *args, **kwargs) -> None:

Review comment:
       ```suggestion
           self,
           *,
           s3_bucket: str,
           s3_key: str,
           file_format: str,
           schema: Optional[str] = None,
           table: Optional[str] = None,
           sql: Optional[str] = None,
           snowflake_conn_id: str = "snowflake_default",
           unload_options: Optional[str] = None,
           autocommit: bool = True,
           **kwargs) -> None:
   ```




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


Reply via email to