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 2022/06/16 11:32:21 UTC

[GitHub] [airflow] eladkal commented on a diff in pull request #24473: Add support for Salesforce bulk api

eladkal commented on code in PR #24473:
URL: https://github.com/apache/airflow/pull/24473#discussion_r898985348


##########
airflow/providers/salesforce/operators/salesforce_bulk.py:
##########
@@ -0,0 +1,245 @@
+# 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.
+from typing import TYPE_CHECKING
+
+from airflow.models import BaseOperator
+from airflow.providers.salesforce.hooks.salesforce import SalesforceHook
+
+if TYPE_CHECKING:
+    from airflow.utils.context import Context
+
+
+class SalesforceBulkInsertOperator(BaseOperator):

Review Comment:
   I think we may need only 1 operator for all actions.
   The bulk api functions are very similar
   Insert:
   https://github.com/simple-salesforce/simple-salesforce/blob/cfd191c547256ebca176ef35df8bc0f3770d7030/simple_salesforce/bulk.py#L272
   
   Upsert:
   https://github.com/simple-salesforce/simple-salesforce/blob/master/simple_salesforce/bulk.py#L280
   
   Update:
   https://github.com/simple-salesforce/simple-salesforce/blob/cfd191c547256ebca176ef35df8bc0f3770d7030/simple_salesforce/bulk.py#L289
   
   etc...
   
   Instead of creating `SalesforceBulkInsertOperator`, `SalesforceBulkUpdateOperator` , `SalesforceBulkUpsertOperator`, etc..
   
   We can create a unified operator that accept method where method can be `update`, `insert`, `upsert` etc and `method_kwargs` where contains all parameters needed for the method. This way it also automatically supports any new parameter that will introduced by the API.
   
   In some way it's similar to what we do with method `parameter` of `TableauOperator`
   



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org