zhongjiajie commented on a change in pull request #4829: [AIRFLOW-3993] Change SalesforceHook and add tests URL: https://github.com/apache/airflow/pull/4829#discussion_r268390289
########## File path: airflow/contrib/hooks/salesforce_hook.py ########## @@ -18,127 +18,110 @@ # 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 Review comment: This is indented too far for docstring rendering? see https://github.com/apache/airflow/pull/4895#discussion_r268388705 ---------------------------------------------------------------- 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
