salesforce - How to do Salesforce SOQL query to only select objects which have record counts greater than zero?
问题描述
I am trying to do a daily copy (daily snapshot) of all the Salesforce objects using Azure Data Factory (ADF) "Copy" activity into an Azure Datalake by first using a Lookup query activity (SOQL as shown below) and then doing a ForEach activity for the list of objects returned from this query:
SELECT qualifiedapiname
FROM EntityDefinition
WHERE IsQueryable = true
AND IsRetrieveable = true
AND IsDeprecatedAndHidden = false
LIMIT 2000
However, this query also returns objects which have no (zero) records at all and I want to skip them. How can we ?
Is there any field/property metadata in Salesforce's EntityDefinition that can tell if the object has any records in it or if its blank, something like "IsBlank = true/false" ?
As per this link:- SOQL doesn't allow count() on EntityDefinition object, therefore it's not possible to find if a certain object (qualifiedApiName) has any records in it from the SQL query:https://developer.salesforce.com/docs/atlas.en-us.api_tooling.meta/api_tooling/reference_objects_soql_limits.htm#topic-title
Running this on ADFv2 with batch count of 50; Auto DIU, and degree of parallelism = 32. Currently, all these SFDC objects have less number of records; but eventually when it starts growing - would have to re-design this pipeline anyways to segregate small objects as daily full copy and large SFDC objects with a one-time load and then incremental loads using either watermark table and/or max last modified date/time method.
Thanks!
解决方案
推荐阅读
- php - Ajax 正确执行 INSERT INTO 一个表但不在另一表上......很奇怪
- html - 始终可见的带有列表的菜单组件
- html - 如何在html中的单元格(嵌套表)中拉伸表格?
- reactjs - 需要操纵从图像中提取的像素,我使用 p5.js 并做出反应
- google-maps - 设置初始中心并放大 google maps API
- python-3.x - 如何排序以便以数字开头的字符串作为第一个字符移动到列表的末尾
- angular - 角度中的多个可能的变量赋值
- java - Json 数组列表转 CSV 格式
- python-3.x - 在 tensorflow 2.0 中使用自定义训练循环时,Val 损失的行为很奇怪
- eclipse - UIMA Ruta、uimaFIT 和 DKPro:哪些版本可以协同工作?