mik-laj commented on a change in pull request #4829: [AIRFLOW-3993] Add tests 
for salesforce hook
URL: https://github.com/apache/airflow/pull/4829#discussion_r261888913
 
 

 ##########
 File path: airflow/contrib/hooks/salesforce_hook.py
 ##########
 @@ -18,127 +18,108 @@
 # under the License.
 #
 """
-This module contains a Salesforce Hook
-which allows you to connect to your Salesforce instance,
-retrieve data from it, and write that data to a file
-for other uses.
+This module contains a Salesforce Hook which allows you to connect to your 
Salesforce instance,
+retrieve data from it, and write that data to a file for other uses.
 
-NOTE:   this hook also relies on the simple_salesforce package:
-        https://github.com/simple-salesforce/simple-salesforce
+NOTE: this hook also relies on the simple_salesforce package:
+      https://github.com/simple-salesforce/simple-salesforce
 """
-from simple_salesforce import Salesforce
-from airflow.hooks.base_hook import BaseHook
-
-import json
+import time
 
 import pandas as pd
-import time
+from simple_salesforce import Salesforce
 
+from airflow.hooks.base_hook import BaseHook
 from airflow.utils.log.logging_mixin import LoggingMixin
 
 
 class SalesforceHook(BaseHook):
-    def __init__(
-            self,
-            conn_id,
-            *args,
-            **kwargs
-    ):
+    def __init__(self, conn_id):
         """
-        Create new connection to Salesforce
-        and allows you to pull data out of SFDC and save it to a file.
+        Create new connection to Salesforce and allows you to pull data out of 
SFDC and save it to a file.
+
+        You can then use that file with other Airflow operators to move the 
data into another data source.
 
-        You can then use that file with other
-        Airflow operators to move the data into another data source
+        :param conn_id: the name of the connection that has the parameters we 
need to connect to Salesforce.
+                        The connection should be type `http` and include a 
user's security token
+                        in the `Extras` field.
+        :type conn_id: str
 
-        :param conn_id:     the name of the connection that has the parameters
-                            we need to connect to Salesforce.
-                            The connection should be type `http` and include a
-                            user's security token in the `Extras` field.
         .. note::
             For the HTTP connection type, you can include a
             JSON structure in the `Extras` field.
             We need a user's security token to connect to Salesforce.
             So we define it in the `Extras` field as:
                 `{"security_token":"YOUR_SECURITY_TOKEN"}`
+
         """
+        super(SalesforceHook, self).__init__(conn_id)
         self.conn_id = conn_id
-        self._args = args
-        self._kwargs = kwargs
-
-        # get the connection parameters
-        self.connection = self.get_connection(conn_id)
-        self.extras = self.connection.extra_dejson
+        self.salesforce = None
 
     def sign_in(self):
 
 Review comment:
   ```suggestion
        def get_conn(self):
   ```
   It is recommended that the `get_conn` method return the API library. Return 
should be cached.

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


With regards,
Apache Git Services

Reply via email to