[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eThis page demonstrates how to use SOQL relationship queries with the Salesforce source in Cloud Data Fusion to efficiently load large amounts of data into Google Cloud.\u003c/p\u003e\n"],["\u003cp\u003eSOQL relationship queries can help reduce the number of API calls needed to retrieve records from Salesforce, simplifying the data loading process.\u003c/p\u003e\n"],["\u003cp\u003eThe page provides examples of relationship queries with a polymorphic key and limits, child-to-parent relationships with custom objects, and WHERE and OFFSET clauses for managing large result sets.\u003c/p\u003e\n"],["\u003cp\u003eReference object fields in the Salesforce plugin are case-sensitive, unlike other fields, a point to keep in mind when creating queries.\u003c/p\u003e\n"],["\u003cp\u003eUsing OFFSET clauses allows for the management of large datasets by returning results in multiple pages, improving the efficiency of handling vast quantities of data.\u003c/p\u003e\n"]]],[],null,["# Use case: SOQL queries for the Salesforce source\n\nThis page shows how to use SOQL relationship queries when you use the Salesforce\nsource in Cloud Data Fusion.\n\nThe Salesforce source lets you seamlessly connect to Salesforce and load large\namounts of data into Google Cloud. To simplify loading the data, you can use\n[SOQL relationship queries](http://www.salesforce.com/us/developer/docs/dbcom_soql_sosl/Content/sforce_api_calls_soql_relationships.htm)\nto retrieve records and reduce the number of API calls in Salesforce.\n\nBefore you begin\n----------------\n\n1. Deploy and configure the properties for the Salesforce source in\n Cloud Data Fusion. For more information, see\n [Salesforce batch source](/data-fusion/docs/how-to/configure-salesforce-batch-source#confirgure).\n\n2. On the **Salesforce** node in your pipeline, click\n **Properties**. This opens the Salesforce plugin properties page.\n\nThe following sections describe how to configure the **SOQL query** field on the\n**Properties** page.\n\nScenario 1: Relationship query with polymorphic key and limits\n--------------------------------------------------------------\n\nThe following relationship query example has a polymorphic key and a limit: \n\n SELECT Id, Owner.Name FROM Task WHERE Owner.FirstName like 'B%' Limit 100\n\nThis query fetches data from a `Task` SObject related to `Owner`. It reads data\nfrom the selected fields in the `Task` SObject. It has a `WHERE` clause and\na placeholder, which you can assign a suitable value.\n\nThis query lets you access the required fields using a placeholder variable. It\nlimits the quantity of records fetched to `100`.\n\nScenario 2: Relationship query with child-to-parent with custom objects\n-----------------------------------------------------------------------\n\nThe following query fetches data from a custom object with child-to-parent\nrelationship: \n\n SELECT Email,newsales__c,Account__r.OwnerId FROM lead WHERE Account__r.Lead Source LIKE 'C%\n\nThis query uses a `SELECT` clause to fetch data from the `Lead` SObject in\nSalesforce with the reference field, `Account__r.OwnerId`.\n\nThe query returns data from the selected fields in the `Lead` SObject and the\nrelational fields from the lookup linked to the `Account` parent object. You can\nquery multiple data fields from a cluster of relational SObjects.\n| **Note:** In the Salesforce plugin, reference object fields are case sensitive, where the other fields aren't.\n\n### Scenario 3: Relationship query with WHERE and OFFSET clauses\n\nThe following query fetches data from multiple SObjects: `Account` and\n`Contacts`, related to a specific `Industry` type and `OFFSET` clause: \n\n SELECT Name, (SELECT LastName FROM Contacts WHERE CreatedBy.Alias = 'x') FROM Account WHERE Industry = 'media'\n offset 4\n\nThe `OFFSET` clause lets you to return results on multiple pages, which is an\nefficient way to handle large results sets.\n\nWhat's next\n-----------\n\n- Configure the [Salesforce batch source](/data-fusion/docs/how-to/configure-salesforce-batch-source#properties) in Cloud Data Fusion.\n- Work through a [Salesforce plugin tutorial](/data-fusion/docs/tutorials/connect-salesforce-to-bq)."]]