我在Azure 数据工厂 V2中工作,尝试从 Salesforce 对象进行查询,其中对象中的 LastModifiedDate 大于或等于最近的日期。我一直在非常简单的SOQL查询中收到语法错误,这些查询在Salesforce Workbench中运行良好。下面,我列出了在 ADF 复制数据活动中运行的查询示例,以及调试管道时收到的错误。
查询 1
Select Id from "Object" WHERE LastModifiedDate >=
@{formatDateTime(activity('Yesterday').output.firstRow.Yesterday,'yyyy-MM-ddTHH:mm:ssZ')}
结果 1
{
"errorCode": "2200",
"message": "Failure happened on 'Source' side. ErrorCode=UserErrorOdbcOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=ERROR [HY000] [Microsoft][Salesforce] (120) SOQL_FIRST mode prepare failure:nSOQL error: [Microsoft][Salesforce] (30) Syntax error or access violation when parsing SOQL.nSQL error: [Microsoft][SQLEngine] (31480) syntax error near 'Select Id from "Object" WHERE LastModifiedDate >= 2018-08-13T16<<< ??? >>>:05:06Z'.,Source=Microsoft.DataTransfer.ClientLibrary.Odbc.OdbcConnector,''Type=System.Data.Odbc.OdbcException,Message=ERROR [HY000] [Microsoft][Salesforce] (120) SOQL_FIRST mode prepare failure:nSOQL error: [Microsoft][Salesforce] (30) Syntax error or access violation when parsing SOQL.nSQL error: [Microsoft][SQLEngine] (31480) syntax error near 'Select Id from "Object" WHERE LastModifiedDate >= 2018-08-13T16<<< ??? >>>:05:06Z'.,Source=Microsoft Salesforce ODBC Driver,'",
"failureType": "UserError",
"target": "Event Fix Pipeline"
}
查询 2
SELECT Id FROM "Object" WHERE LastModifiedDate >= 2018-08-14T00:00:00Z
结果 2
{
"errorCode": "2200",
"message": "Failure happened on 'Source' side. ErrorCode=UserErrorOdbcOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=ERROR [HY000] [Microsoft][Salesforce] (120) SOQL_FIRST mode prepare failure:nSOQL error: [Microsoft][Salesforce] (30) Syntax error or access violation when parsing SOQL.nSQL error: [Microsoft][SQLEngine] (31480) syntax error near 'SELECT Id FROM "Object" WHERE LastModifiedDate >= 2018-08-14T00<<< ??? >>>:00:00Z'.,Source=Microsoft.DataTransfer.ClientLibrary.Odbc.OdbcConnector,''Type=System.Data.Odbc.OdbcException,Message=ERROR [HY000] [Microsoft][Salesforce] (120) SOQL_FIRST mode prepare failure:nSOQL error: [Microsoft][Salesforce] (30) Syntax error or access violation when parsing SOQL.nSQL error: [Microsoft][SQLEngine] (31480) syntax error near 'SELECT Id FROM "Object" WHERE LastModifiedDate >= 2018-08-14T00<<< ??? >>>:00:00Z'.,Source=Microsoft Salesforce ODBC Driver,'",
"failureType": "UserError",
"target": "Event Fix Pipeline"
}
可能导致此语法错误的原因是什么?
删除 Object 周围的引号似乎可以解决您的问题。
从对象中选择 ID,其中上次修改日期>= 2018-08-14T00:00:00Z。
我在 Salesforce 开发人员控制台中测试了带有引号的查询,并得到了"解析查询时出现未知错误",因此我认为这是一个带有引号的无效 SOQL 查询。
哈哈,就我而言,它是 SOQL 语句末尾的分号。