Use case: SOQL queries for the Salesforce source Stay organized with collections Save and categorize content based on your preferences.
This page shows how to use SOQL relationship queries when you use the Salesforcesource in Cloud Data Fusion.
The Salesforce source lets you seamlessly connect to Salesforce and load largeamounts of data into Google Cloud. To simplify loading the data, you can useSOQL relationship queriesto retrieve records and reduce the number of API calls in Salesforce.
Before you begin
Deploy and configure the properties for the Salesforce source inCloud Data Fusion. For more information, seeSalesforce batch source.
On theSalesforce node in your pipeline, clickProperties. This opens the Salesforce plugin properties page.
The following sections describe how to configure theSOQL query field on theProperties page.
Scenario 1: Relationship query with polymorphic key and limits
The following relationship query example has a polymorphic key and a limit:
SELECTId,Owner.NameFROMTaskWHEREOwner.FirstNamelike'B%'Limit100This query fetches data from aTask SObject related toOwner. It reads datafrom the selected fields in theTask SObject. It has aWHERE clause anda placeholder, which you can assign a suitable value.
This query lets you access the required fields using a placeholder variable. Itlimits the quantity of records fetched to100.
Scenario 2: Relationship query with child-to-parent with custom objects
The following query fetches data from a custom object with child-to-parentrelationship:
SELECTEmail,newsales__c,Account__r.OwnerIdFROMleadWHEREAccount__r.LeadSourceLIKE'C%This query uses aSELECT clause to fetch data from theLead SObject inSalesforce with the reference field,Account__r.OwnerId.
The query returns data from the selected fields in theLead SObject and therelational fields from the lookup linked to theAccount parent object. You canquery multiple data fields from a cluster of relational SObjects.
Scenario 3: Relationship query with WHERE and OFFSET clauses
The following query fetches data from multiple SObjects:Account andContacts, related to a specificIndustry type andOFFSET clause:
SELECTName,(SELECTLastNameFROMContactsWHERECreatedBy.Alias='x')FROMAccountWHEREIndustry='media'offset4TheOFFSET clause lets you to return results on multiple pages, which is anefficient way to handle large results sets.
What's next
- Configure theSalesforce batch source in Cloud Data Fusion.
- Work through aSalesforce plugin tutorial.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.