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 2021/01/07 11:04:50 UTC

[GitHub] [airflow] feluelle commented on a change in pull request #12033: AllowDiskUse parameter and docs in MongotoS3Operator

feluelle commented on a change in pull request #12033:
URL: https://github.com/apache/airflow/pull/12033#discussion_r553259880



##########
File path: airflow/providers/amazon/aws/transfers/mongo_to_s3.py
##########
@@ -25,77 +26,99 @@
 from airflow.providers.mongo.hooks.mongo import MongoHook
 from airflow.utils.decorators import apply_defaults
 
+_DEPRECATION_MSG = (
+    "The s3_conn_id parameter has been deprecated. You should pass instead the aws_conn_id parameter."
+)
+
 
 class MongoToS3Operator(BaseOperator):
-    """
-    Mongo -> S3
-        A more specific baseOperator meant to move data
-        from mongo via pymongo to s3 via boto
-
-        things to note
-                .execute() is written to depend on .transform()
-                .transform() is meant to be extended by child classes
-                to perform transformations unique to those operators needs
+    """Operator meant to move data from mongo via pymongo to s3 via boto.
+
+    :param mongo_conn_id: reference to a specific mongo connection
+    :type mongo_conn_id: str
+    :param aws_conn_id: reference to a specific S3 connection
+    :type aws_conn_id: str
+    :param mongo_collection: reference to a specific collection in your mongo db
+    :type mongo_collection: str
+    :param mongo_query: query to execute. A list including a dict of the query
+    :type mongo_query: list
+    :param s3_bucket: reference to a specific S3 bucket to store the data
+    :type s3_bucket: str
+    :param s3_key: in which S3 key the file will be stored
+    :type s3_key: str
+    :param mongo_db: reference to a specific mongo database
+    :type mongo_db: str
+    :param replace: whether or not to replace the file in S3 if it previously existed
+    :param replace: bool
+    :param allow_disk_use: in the case you are retrieving a lot of data, you may have
+        to use the disk to save it instead of saving all in the RAM
+    :param allow_disk_use: bool
     """
 
-    template_fields = ['s3_key', 'mongo_query', 'mongo_collection']
+    template_fields = ('s3_bucket', 's3_key', 'mongo_query', 'mongo_collection')
     # pylint: disable=too-many-instance-attributes
 
     @apply_defaults
     def __init__(
         self,
         *,
-        mongo_conn_id: str,
-        s3_conn_id: str,
+        s3_conn_id: Optional[str] = None,
+        mongo_conn_id: str = 'mongo_default',
+        aws_conn_id: str = 'aws_default',
         mongo_collection: str,
         mongo_query: Union[list, dict],
         s3_bucket: str,
         s3_key: str,
         mongo_db: Optional[str] = None,
         replace: bool = False,
+        allow_disk_use: bool = False,
         compression: Optional[str] = None,

Review comment:
       sry @JavierLopezT I forgot to mention it in the other PR #13187, but can you also add documentation around compression. Maybe @DreamPearl can help you with that? :)
   
   That would be great. Thanks.




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