Recently my friend asked how to extract Salesforce data and ingest into Snowflake via Python. Though Salesforce has released out of box Tableau CRM Sync Out connector to provide integration among Salesforce with Snowflake. Moreover, Connector moves Salesforce data directly into Snowflake, simplifying the data pipeline and reducing latency. However requirement was to achieve this integration via python code.
For our POC we will consider the BIG Objects in Salesforce. BIG OBJECTS, provides data storage that does not count against the storage limit, Manage massive data within Salesforce without affecting performances. As part of the data movement, we will fetch the data from BIG OBJECT say snowdata__b and load into Dataframe. Later on, this Data frame will be loaded to the snowflake.
Please see the below technical steps:
- To connect Python with Salesforce, we must install simple_Salesforce.
- Then connect with salesforce using Username/Password and Security token.
- Fetch the data using query_all from Salesforce and store in the Pandas Dataframe.
- Connect to the Snowflake using SQL Alchemy.
- Insert the dataframe(SF Data) into Snowflake
Also we will see how to read the data from the CSV file and load into the Salesforce using Python:
Table Created in Snowflake.
After processing CSV file, Records created in Salesforce: