Azure 流分析 CreateOrReplace 转换冲突或错误请求
Azure Stream Analytics CreateOrReplace Transformation Conflict or Bad Request
我们目前正在通过 Azure 流分析将数据从 Azure 事件中心流式传输到 Cosmos DB。我希望能够以编程方式更改在数据流式传输时完成的查询(/转换)。
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);
Stream Analytics Job Properties - 转换显示为空。
不清楚转换的默认名称可能是什么,但正在尝试从作业中获取转换(与作业同名):
{
"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 门户创建转换,转换的默认名称是 "Transformation"。如果您从 SDK 创建转换,您需要在代码中指定名称。
streamAnalyticsManagementClient.Transformations.CreateOrReplace(transformation, resourceGroupName, streamingJobName, transformationName);
顺便说一下,我在从 Azure 门户添加查询后从 Activity 日志中找到了默认转换名称。
您可以使用 Powershell 或 CloudPowershell 通过 Get-AzStreamAnalyticsJob
获取转换名称。在我的例子中,有多个作业,我需要在列表中找到第一个作业的转换名称。
$ (Get-AzStreamAnalyticsJob -expand 'Transformation')[0].TransformationName
不过我在 Azure 门户中找不到转换名称。
我们目前正在通过 Azure 流分析将数据从 Azure 事件中心流式传输到 Cosmos DB。我希望能够以编程方式更改在数据流式传输时完成的查询(/转换)。
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);
Stream Analytics Job Properties - 转换显示为空。
不清楚转换的默认名称可能是什么,但正在尝试从作业中获取转换(与作业同名):
{
"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 门户创建转换,转换的默认名称是 "Transformation"。如果您从 SDK 创建转换,您需要在代码中指定名称。
streamAnalyticsManagementClient.Transformations.CreateOrReplace(transformation, resourceGroupName, streamingJobName, transformationName);
顺便说一下,我在从 Azure 门户添加查询后从 Activity 日志中找到了默认转换名称。
您可以使用 Powershell 或 CloudPowershell 通过 Get-AzStreamAnalyticsJob
获取转换名称。在我的例子中,有多个作业,我需要在列表中找到第一个作业的转换名称。
$ (Get-AzStreamAnalyticsJob -expand 'Transformation')[0].TransformationName
不过我在 Azure 门户中找不到转换名称。