Azure 逻辑应用在 SQL 连接上失败
Azure LogicApp Fails on SQL Connection
我正在尝试调用 Azure 逻辑应用程序中的存储过程。但是,每当我尝试连接到 DB & select 过程或执行应用程序时,我都会收到以下错误。
`
{
"status": 400,
"message": "Can not add property StartTime to Newtonsoft.Json.Linq.JObject. Property with the same name already exists on object.\r\nclientRequestId: 99825289-bbe8-4b91-8323-075e8cacd09c",
"source": "sql-logic-cp-centralindia.logic-ase-centralindia.p.azurewebsites.net"
}
`
如果尝试执行 SQL select 查询而不是存储过程,我会遇到同样的错误。
这是逻辑应用程序的代码。有什么建议么?
`
{
"$connections": {
"value": {
"sql": {
"connectionId": "/subscriptions/XXXX/resourceGroups/Reports/providers/Microsoft.Web/connections/sql",
"connectionName": "sql",
"id": "/subscriptions/XXXX/providers/Microsoft.Web/locations/centralindia/managedApis/sql"
}
}
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Execute_stored_procedure": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['sql']['connectionId']"
}
},
"method": "post",
"path": "/datasets/default/procedures/@{encodeURIComponent(encodeURIComponent('[dbo].[SchoolDataDump]'))}"
},
"runAfter": {},
"type": "ApiConnection"
},
"Response": {
"inputs": {
"statusCode": 200
},
"kind": "http",
"runAfter": {
"Execute_stored_procedure": [
"Succeeded"
]
},
"type": "Response"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
}
}
`
好吧,这是一个棘手的错误。经过一番斗争,我能够弄清楚这个问题。
在我的 select 查询中,我有两个同名的字段。这导致了创建输出 JSON 的问题。
我在查询中有两个字段,如下所示
Select .. SM.StartTime,... SS.StartTime from tables .. joins
SQL 输出在 SQL 输出中有两次 StartTime。所以我添加了一个别名如下,它解决了这个问题。
Select .. SM.StartTime,... SS.StartTime as SessionStartTime from tables .. joins
我正在尝试调用 Azure 逻辑应用程序中的存储过程。但是,每当我尝试连接到 DB & select 过程或执行应用程序时,我都会收到以下错误。
`
{
"status": 400,
"message": "Can not add property StartTime to Newtonsoft.Json.Linq.JObject. Property with the same name already exists on object.\r\nclientRequestId: 99825289-bbe8-4b91-8323-075e8cacd09c",
"source": "sql-logic-cp-centralindia.logic-ase-centralindia.p.azurewebsites.net"
}
`
如果尝试执行 SQL select 查询而不是存储过程,我会遇到同样的错误。
这是逻辑应用程序的代码。有什么建议么?
`
{
"$connections": {
"value": {
"sql": {
"connectionId": "/subscriptions/XXXX/resourceGroups/Reports/providers/Microsoft.Web/connections/sql",
"connectionName": "sql",
"id": "/subscriptions/XXXX/providers/Microsoft.Web/locations/centralindia/managedApis/sql"
}
}
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Execute_stored_procedure": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['sql']['connectionId']"
}
},
"method": "post",
"path": "/datasets/default/procedures/@{encodeURIComponent(encodeURIComponent('[dbo].[SchoolDataDump]'))}"
},
"runAfter": {},
"type": "ApiConnection"
},
"Response": {
"inputs": {
"statusCode": 200
},
"kind": "http",
"runAfter": {
"Execute_stored_procedure": [
"Succeeded"
]
},
"type": "Response"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
}
}
`
好吧,这是一个棘手的错误。经过一番斗争,我能够弄清楚这个问题。 在我的 select 查询中,我有两个同名的字段。这导致了创建输出 JSON 的问题。
我在查询中有两个字段,如下所示
Select .. SM.StartTime,... SS.StartTime from tables .. joins
SQL 输出在 SQL 输出中有两次 StartTime。所以我添加了一个别名如下,它解决了这个问题。
Select .. SM.StartTime,... SS.StartTime as SessionStartTime from tables .. joins