Warehouses and Lakes
Sales & Support Analytics

How to load data from Salesforce to BigQuery

Learn how to use Airbyte to synchronize your Salesforce data into BigQuery within minutes.

TL;DR

This can be done by building a data pipeline manually, usually a Python script (you can leverage a tool as Apache Airflow for this). This process can take more than a full week of development. Or it can be done in minutes on Airbyte in three easy steps:

  1. set up Salesforce as a source connector (using Auth, or usually an API key)
  2. set up BigQuery as a destination connector
  3. define which data you want to transfer and how frequently

You can choose to self-host the pipeline using Airbyte Open Source or have it managed for you with Airbyte Cloud.

This tutorial’s purpose is to show you how.

What is Salesforce

Salesforce is a cloud-based customer relationship management (CRM) platform providing business solutions software on a subscription basis. Salesforce is a huge force in the ecommerce world, helping businesses with marketing, commerce, service and sales, and enabling enterprises’ IT teams to collaborate easily from anywhere. Salesforces is the force behind many industries, offering healthcare, automotive, finance, media, communications, and manufacturing multichannel support. Its services are wide-ranging, with access to customer, partner, and developer communities as well as an app exchange marketplace.

What is BigQuery

BigQuery is an enterprise data warehouse that draws on the processing power of Google Cloud Storage to enable fast processing of SQL queries through massive datasets. BigQuery helps businesses select the most appropriate software provider to assemble their data, based on the platforms the business uses. Once a business’ data is acculumated, it is moved into BigQuery. The company controls access to the data, but BigQuery stores and processes it for greater speed and convenience.

Prerequisites

  1. A Salesforce account to transfer your customer data automatically from.
  2. A BigQuery account.
  3. An active Airbyte Cloud account, or you can also choose to use Airbyte Open Source locally. You can follow the instructions to set up Airbyte on your system using docker-compose.

Airbyte is an open-source data integration platform that consolidates and streamlines the process of extracting and loading data from multiple data sources to data warehouses. It offers pre-built connectors, including Salesforce and BigQuery, for seamless data migration.

When using Airbyte to move data from Salesforce to BigQuery, it extracts data from Salesforce using the source connector, converts it into a format BigQuery can ingest using the provided schema, and then loads it into BigQuery via the destination connector. This allows businesses to leverage their Salesforce data for advanced analytics and insights within BigQuery, simplifying the ETL process and saving significant time and resources.

Step 1: Set up Salesforce as a source connector

1. Open the Airbyte platform and navigate to the "Sources" tab on the left-hand side of the screen.

2. Click on the "Salesforce" source connector and select "Create new connection."

3. Enter a name for your connection and click "Next."

4. Enter your Salesforce credentials, including your username, password, and security token.

5. Click "Test connection" to ensure that your credentials are correct and that Airbyte can connect to your Salesforce account.

6. Once the connection is successful, select the objects you want to replicate from Salesforce.

7. Choose the replication frequency and any other settings you want to apply to your connection.

8. Click "Create connection" to save your settings and start replicating data from Salesforce to Airbyte.

9. You can monitor the progress of your replication in the "Connections" tab and view the data in the "Dashboard" tab.

Step 2: Set up BigQuery as a destination connector

1. First, navigate to the Airbyte dashboard and select the "Destinations" tab on the left-hand side of the screen.

2. Scroll down until you find the "BigQuery" destination connector and click on it.

3. Click the "Create Destination" button to begin setting up your BigQuery destination.

4. Enter your Google Cloud Platform project ID and service account credentials in the appropriate fields.

5. Next, select the dataset you want to use for your destination and enter the table prefix you want to use.

6. Choose the schema mapping for your data, which will determine how your data is organized in BigQuery.

7. Finally, review your settings and click the "Create Destination" button to complete the setup process.

8. Once your destination is created, you can begin configuring your source connectors to start syncing data to BigQuery.

9. To do this, navigate to the "Sources" tab on the left-hand side of the screen and select the source connector you want to use.

10. Follow the prompts to enter your source credentials and configure your sync settings.

11. When you reach the "Destination" step, select your BigQuery destination from the dropdown menu and choose the dataset and table prefix you want to use.

12. Review your settings and click the "Create Connection" button to start syncing data from your source to your BigQuery destination.

Should you build or buy your data pipelines?

Download our free guide and discover the best approach for your needs, whether it's building your ELT solution in-house or opting for Airbyte Open Source or Airbyte Cloud.

Download now

Step 3: Set up a connection to sync your Salesforce data to BigQuery

Once you've successfully connected Salesforce as a data source and BigQuery as a destination in Airbyte, you can set up a data pipeline between them with the following steps:

  1. Create a new connection: On the Airbyte dashboard, navigate to the 'Connections' tab and click the '+ New Connection' button.
  2. Choose your source: Select Salesforce from the dropdown list of your configured sources.
  3. Select your destination: Choose BigQuery from the dropdown list of your configured destinations.
  4. Configure your sync: Define the frequency of your data syncs based on your business needs. Airbyte allows both manual and automatic scheduling for your data refreshes.
  5. Select the data to sync: Choose the specific Salesforce objects you want to import data from towards BigQuery. You can sync all data or select specific tables and fields.
  6. Select the sync mode for your streams: Choose between full refreshes or incremental syncs (with deduplication if you want), and this for all streams or at the stream level. Incremental is only available for streams that have a primary cursor.
  7. Test your connection: Click the 'Test Connection' button to make sure that your setup works. If the connection test is successful, save your configuration.
  8. Start the sync: If the test passes, click 'Set Up Connection'. Airbyte will start moving data from Salesforce to BigQuery according to your settings.

Remember, Airbyte keeps your data in sync at the frequency you determine, ensuring your BigQuery data warehouse is always up-to-date with your Salesforce data.

Use Cases to transfer your Salesforce data to BigQuery

Integrating data from Salesforce to BigQuery provides several benefits. Here are a few use cases:

  1. Advanced Analytics: BigQuery’s powerful data processing capabilities enable you to perform complex queries and data analysis on your Salesforce data, extracting insights that wouldn't be possible within Salesforce alone.
  2. Data Consolidation: If you're using multiple other sources along with Salesforce, syncing to BigQuery allows you to centralize your data for a holistic view of your operations, and to set up a change data capture process so you never have any discrepancies in your data again.
  3. Historical Data Analysis: Salesforce has limits on historical data. Syncing data to BigQuery allows for long-term data retention and analysis of historical trends over time.
  4. Data Security and Compliance: BigQuery provides robust data security features. Syncing Salesforce data to BigQuery ensures your data is secured and allows for advanced data governance and compliance management.
  5. Scalability: BigQuery can handle large volumes of data without affecting performance, providing an ideal solution for growing businesses with expanding Salesforce data.
  6. Data Science and Machine Learning: By having Salesforce data in BigQuery, you can apply machine learning models to your data for predictive analytics, customer segmentation, and more.
  7. Reporting and Visualization: While Salesforce provides reporting tools, data visualization tools like Tableau, PowerBI, Looker (Google Data Studio) can connect to BigQuery, providing more advanced business intelligence options. If you have a Salesforce table that needs to be converted to a BigQuery table, Airbyte can do that automatically.

Wrapping Up

To summarize, this tutorial has shown you how to:

  1. Configure a Salesforce account as an Airbyte data source connector.
  2. Configure BigQuery as a data destination connector.
  3. Create an Airbyte data pipeline that will automatically be moving data directly from Salesforce to BigQuery after you set a schedule

With Airbyte, creating data pipelines take minutes, and the data integration possibilities are endless. Airbyte supports the largest catalog of API tools, databases, and files, among other sources. Airbyte's connectors are open-source, so you can add any custom objects to the connector, or even build a new connector from scratch without any local dev environment or any data engineer within 10 minutes with the no-code connector builder.

We look forward to seeing you make use of it! We invite you to join the conversation on our community Slack Channel, or sign up for our newsletter. You should also check out other Airbyte tutorials, and Airbyte’s content hub!

What should you do next?

Hope you enjoyed the reading. Here are the 3 ways we can help you in your data journey:

flag icon
Easily address your data movement needs with Airbyte Cloud
Take the first step towards extensible data movement infrastructure that will give a ton of time back to your data team. 
Get started with Airbyte for free
high five icon
Talk to a data infrastructure expert
Get a free consultation with an Airbyte expert to significantly improve your data movement infrastructure. 
Talk to sales
stars sparkling
Improve your data infrastructure knowledge
Subscribe to our monthly newsletter and get the community’s new enlightening content along with Airbyte’s progress in their mission to solve data integration once and for all.
Subscribe to newsletter

By integrating marketing, sales, service, and IT teams into one platform, Salesforce has transformed the way businesses operate. However, in today’s changing data landscape, you cannot simply rely on Salesforce itself to derive maximum value for your business. In fact, you need a combination of Salesforce and a powerful data warehouse like Google’s BigQuery so you can open the doors to more robust analytical insights and in turn, drive increased revenue and growth.

In this recipe, we will explore the benefits of why you should consider moving data from your Salesforce to BigQuery, and then demonstrate how you can easily leverage Airbyte to do the job.

Why centralize data from Salesforce to a BigQuery?

Let’s look at some of the reasons why you might want to centralize your Salesforce data into a data warehouse.

Out-of-the-box reporting is not sufficient and difficult to use

While Salesforce is a powerful tool, its default data capabilities are limited. There are hard restrictions on reporting and dashboard capabilities, which makes it inflexible to use for different scenarios. Moreover, when analyzing historical data in Salesforce, the timing of the snapshots has to be planned in advance and cannot be changed on the fly.  On top of that, there are other limitations when it comes to large reports with over 100 fields.

Customizing Salesforce can be very expensive and time-consuming

Customizing Salesforce workflows is typically a multi-step process involving hiring certified Salesforce consultants, building an in-house development team, and ultimately collaborating. Once the solution is built, your staff will need to be trained to use it effectively. All of this not only takes time and effort, but can also be quite expensive. The cost of highly customized Salesforce implementations can range from $10,000 to well over $50,000 depending on the complexity of the company's internal processes.

Salesforce's pricing limits access

Salesforce's pricing model is based on pay-per-user, and purchasing an annual license is required to get started. This policy will likely force you to limit the number of Salesforce users in your enterprise to bring down costs. With limited possibilities of sharing, collaboration can be challenging - one of the reasons why Salesforce was implemented to begin with. For example, with this limitation, reports can only be shared with paid Salesforce users. Therefore a C-level executive who might only need to view a report will be unable to do so without paying a license fee.

Why use Airbyte to extract Salesforce data

Now that you realize the value of moving Salesforce data into a data warehouse, how do you implement that process?

In most cases, many businesses start by writing custom ETL scripts but the truth is that they don't succeed with them.  Manually writing scripts for this will slow down your project's velocity. Moreover, if these scripts are typically brittle — constant care and time need to be devoted to keep these scripts running. With automation, you can ditch the complex hardcoded scripts that handle data wrangling and scheduling, enabling your teams to work efficiently. Thanks to Airbyte, connectors are open-source and easily customizable. They help you seamlessly integrate your data that is residing across many business apps and databases in your data warehouse. With Airbyte, you get full control over your data in an effortless way. Data is deduplicated and can be transformed on the fly based on custom business logic rules with SQL. Airbyte has built-in scheduling, orchestration, and monitoring. Airbyte's ready-to-go scheduler enables you to replicate data either fully or in an incremental fashion, removing any manual intervention and allowing your developers to focus on more critical matters.

Now, let’s get started with the how-to’s of using Airbyte to replicate data from Salesforce to BigQuery.

Prerequisites

Below are the prerequisite tools you’ll need to get started on backing up your Salesforce data to your Google BigQuery.

  1. You’ll need to get Airbyte to do the data replication for you. To deploy Airbyte, follow the simple instructions in our documentation here.
  2. You will need a Salesforce account.
  3. You also need a Google Cloud Platform account with the BigQuery service enabled.

Salesforce accounts can be created by signing up at the link here. Note: You will need at least a developer account for Airbyte to be able to access Salesforce REST APIs. To set up and create a GCP account with the BigQuery service enabled, follow the instructions at the link here.

Configure your Salesforce account

The first step is to configure your Salesforce account to allow external applications to connect and access data from the account. Login to Salesforce and go to Setup > Create > Apps and select New in the Connected Apps section.

Fill in the required fields.

Next, enable the OAuth settings, enter https://login.salesforce.com/ under Callback URL and select the following Oauth Scopes.

Save the connected app. Once saved you should be able to see your Consumer Key and Consumer Secret. Make a note of these values which will be used later.

Next you will have to allow access to the connected apps and generate an authorization code which will then be used to get your refresh token which is required to configure Airbyte for Salesforce.

Login to Salesforce and in a new browser tab, go to the following URL: https://.salesforce.com/services/oauth2/authorize?response_type=code&client_id=&redirect_uri=https://login.salesforce.com/

can be found in your Salesforce account verification email. After hitting the URL, you will be prompted to allow access.

Copy the value following code in the URL. This will be used as the authorization code in the next step.

Next you will need to make a POST request to https://.salesforce.com/services/oauth2/token with the following parameters.

Set client_id to , code to the authorization code from the previous step, grant_type to authorization_code, client_secret to and the redirect_url to https://login.salesforce.com/

The response will contain a value for refresh_token which will be required to configure Airbyte.

Add sample data to Salesforce

In the next step we will generate and import sample data into Salesforce. For this example we will create Leads data. Go to https://www.mockaroo.com/ and create the Leads dataset with the following fields.

This will generate a CSV with sample data.

Next login to Salesforce and go to Setup > Data > Data Import Wizard. Choose the Leads object, upload the CSV and follow the Wizard steps to upload the data.

Once complete, you can view the data by going to the Salesforce homepage > Leads.

Set up Google BigQuery

The next step is to create a BigQuery dataset and generate a credentials JSON file required to configure Airbyte. Login to your GCP account and go to BigQuery.

Select Create a Dataset and give and add the required information.

Next, go to the Service Account page and Create a new Service account. Enter the required information. Grant the service account the BigQuery Data Owner role.

Once the service account is created, go to Keys > Add Key and create a new key. You will be prompted to download a credentials file. Download the JSON version which will be used later.

Set up Salesforce as your Airbyte source

Next, set up the connection for the source, which will be your Salesforce account. Under client_id, enter , under client_secret enter and under refresh_token, enter the refresh token obtained at the end of Step 1.

Set up BigQuery as your Airbyte destination

Next,  set up Airbyte to use BigQuery as the destination for the data replication. Enter your GCP project-id, dataset ID, and dataset location. Copy the contents of the credentials JSON.

Create a Salesforce to BigQuery connection

Once configured, a list of Salesforce streams that data can be backed up.

Scroll through and select the Leads stream that contains the sample data.  

Note: You need to have billing enabled in your BigQuery service for normalization to work without any errors.

Once configured you can manually trigger a sync. Once complete, your data will be backed up to BigQuery.

You can see two tables created in your dataset. The Lead table contains the normalized data.

You can also view your data by going to the dataset and going to the _airbyte_raw_lead table.

You can test out the incremental Sync Append by generating another sample data file and uploading it to Salesforce. Running the sync again will add the additional items to BigQuery.

In this case, an additional 1065 items were added. You can verify the total row count in your dataset by running the following in the BigQuery UI:


Wrapping up

Now that you have replicated your Salesforce data to Google BigQuery, you can leverage the rich analytical capabilities of BigQuery to extract more insights from this data. Good luck, and we wish you all the best using Airbyte!

Now that you've replicated your Salesforce data to Google BigQuery, checkout another article to discover how Google BigQuery Sandbox can amplify your data insights journey after replicating Salesforce data.

Join the conversation at Airbyte’s community Slack Channel to share your ideas with over 1000 data engineers and help make everyone’s project successful.

What should you do next?

Hope you enjoyed the reading. Here are the 3 ways we can help you in your data journey:

flag icon
Easily address your data movement needs with Airbyte Cloud
Take the first step towards extensible data movement infrastructure that will give a ton of time back to your data team. 
Get started with Airbyte for free
high five icon
Talk to a data infrastructure expert
Get a free consultation with an Airbyte expert to significantly improve your data movement infrastructure. 
Talk to sales
stars sparkling
Improve your data infrastructure knowledge
Subscribe to our monthly newsletter and get the community’s new enlightening content along with Airbyte’s progress in their mission to solve data integration once and for all.
Subscribe to newsletter

Should you build or buy your data pipelines?

Download our free guide and discover the best approach for your needs, whether it's building your ELT solution in-house or opting for Airbyte Open Source or Airbyte Cloud.

Download now

Frequently Asked Questions

What data can you extract from Salesforce?

Salesforce's API provides access to a wide range of data types, including:  

1. Accounts: Information about customer accounts, including contact details, billing information, and purchase history.  

2. Leads: Data on potential customers, including contact information, lead source, and lead status.  

3. Opportunities: Information on potential sales deals, including deal size, stage, and probability of closing.  

4. Contacts: Details on individual contacts associated with customer accounts, including contact information and activity history.  

5. Cases: Information on customer service cases, including case details, status, and resolution.  

6. Products: Data on products and services offered by the company, including pricing, availability, and product descriptions.  

7. Campaigns: Information on marketing campaigns, including campaign details, status, and results.  

8. Reports and Dashboards: Access to pre-built and custom reports and dashboards that provide insights into sales, marketing, and customer service performance.  

9. Custom Objects: Ability to access and manipulate custom objects created by the organization to store specific types of data.  

Overall, Salesforce's API provides access to a comprehensive set of data types that enable organizations to manage and analyze their customer relationships, sales processes, and marketing campaigns.

What data can you transfer to BigQuery?

You can transfer a wide variety of data to BigQuery. This usually includes structured, semi-structured, and unstructured data like transaction records, log files, JSON data, CSV files, and more, allowing robust, scalable data integration and analysis.

What are top ETL tools to transfer data from Salesforce to BigQuery?

The most prominent ETL tools to transfer data from Salesforce to BigQuery include:

  • Airbyte
  • Fivetran
  • Stitch
  • Matillion
  • Talend Data Integration

These tools help in extracting data from Salesforce and various sources (APIs, databases, and more), transforming it efficiently, and loading it into BigQuery and other databases, data warehouses and data lakes, enhancing data management capabilities.