Azure Stream Analytics CreateOrReplace转换冲突或错误请求
我们目前正在通过Azure Stream Analytics将Azure事件中心的数据流传输到Cosmos DB。我希望能够通过编程更改数据流传输时完成的查询(/Transformation)Azure Stream Analytics CreateOrReplace转换冲突或错误请求,azure,azure-cosmosdb,azure-eventhub,azure-stream-analytics,Azure,Azure Cosmosdb,Azure Eventhub,Azure Stream Analytics,我们目前正在通过Azure Stream Analytics将Azure事件中心的数据流传输到Cosmos DB。我希望能够通过编程更改数据流传输时完成的查询(/Transformation) var existingQuery = AnalyticsClient.Transformations.Get(handler.ResourceGroup, handler.JobName, handler.JobName); if (job.JobState == "Started")
var existingQuery = AnalyticsClient.Transformations.Get(handler.ResourceGroup, handler.JobName, handler.JobName);
if (job.JobState == "Started")
{
AnalyticsClient.StreamingJobs.BeginStopAsync(handler.ResourceGroup, handler.JobName).Wait();
}
var transformation = new Transformation()
{
Query = $@"SELECT
[key] as partition_key
INTO[{outputName}]
FROM Input",
StreamingUnits = 1
};
AnalyticsClient.Transformations.CreateOrReplace(transformation, handler.ResourceGroup, handler.JobName, handler.JobName);
-转换显示为空
不清楚转换的默认名称可能是什么,但试图从作业中获取转换(与作业同名):
{
"code": "NotFound",
"message": "StreamAnalytics_Prototype_2 does not exist in Stream Analytics job 'StreamAnalytics_Prototype_2' in resource group 'removed' in subscription 'removed'.",
"details": {
"code": "404",
"message": "StreamAnalytics_Prototype_2 does not exist in Stream Analytics job 'StreamAnalytics_Prototype_2' in resource group 'removed' in subscription 'removed'.",
"correlationId": "removed",
"requestId": "removed"
}
}
尝试创建转换:
{
"code": "BadRequest",
"message": "The number of transformations defined for this job exceeds the maximum limit of 1 that is supported.",
"details": {
"code": "400",
"message": "The number of transformations defined for this job exceeds the maximum limit of 1 that is supported."
}
}
如果您从Azure portal创建转换,则转换的默认名称为“transformation”。如果从SDK创建转换,则需要在代码中指定名称
streamAnalyticsManagementClient.Transformations.CreateOrReplace(transformation, resourceGroupName, streamingJobName, transformationName);
顺便说一下,在添加了来自Azure portal的查询后,我从活动日志中找到了默认转换名称
非常感谢;这也很有用:var streamingjob=AnalyticsClient.StreamingJobs.Get(ResourceGroup,JobName,“transformation”);我还有一个名为script的查询流(我假设一个开发人员通过.net创建了它),我可以通过活动日志中的上述方法进行检查。