Azure 流分析 CreateOrReplace 转换冲突或错误请求

标签 azure azure-cosmosdb azure-eventhub azure-stream-analytics

我们目前正在通过 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 门户添加查询后,我从事件日志中找到了默认转换名称。

enter image description here

关于Azure 流分析 CreateOrReplace 转换冲突或错误请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45171610/

相关文章:

azure - KQL - 基于特定列限制数据量

sql - 大型搜索中缺少 Cosmos DB 结果

c# - 如何使用 SAS 解决 Azure 事件中心中的授权错误 (401)?

javascript - 从 Azure IotHub/EventHub 获取 deviceId

Azure 服务总线 ACS 颁发者和 key 丢失

windows - 如何使用 Packer 在 Azure 中构建具有大文件的镜像?

c# - HostingEnvironment.QueueBackgroundWorkItem 永远不会在 azure 部署的 asp.net mvc 4.5 应用程序上执行

azure - Cosmos 插入不会有效并行化

javascript - Cosmos DB 存储过程

Azure 事件中心 REST API : Why specify the publisher in the URL when sending events?