azure - 通过 C# 将数据插入到 Azure 数据资源管理器

标签 azure azure-data-explorer

我正在尝试使用 Kusto.Data NuGet (C#) 将应用程序日志数据提取到 Azure 数据资源管理器。我可以使用以下方法检索数据,但在检索数据时它不起作用。我是否使用了错误的插入查询模式?

var kustoConnectionStringBuilder =
            new KustoConnectionStringBuilder(kustoUri, database)
            {
                FederatedSecurity = true,
                InitialCatalog = database,
                UserID = user,
                Password = password,
                Authority = tenantId
            };
            var client = KustoClientFactory.CreateCslQueryProvider(kustoConnectionStringBuilder);
            string query = "ingest inline into table Device <| 1,DeviceId";
            client.ExecuteQuery(query);

错误消息:语法错误:无法解析查询:发生识别错误。有人可以帮我解决这个问题吗? 我的设备表现在有两列:Id(int),Description(string)

最佳答案

您发布的代码片段存在几个问题:

a. 您正在使用 ICslQueryProvider 而不是 ICslAdminProvider,并且使用 ExecuteQuery() 而不是执行控制命令().ingest (或以点 (.) 开头的任何其他内容都是控制命令: https://learn.microsoft.com/en-us/azure/kusto/management/#differentiating-control-commands-from-queries )

b. 您在摄取之前缺少一个点(.)(应为.ingest) .

c. 您正在使用直接提取而不是排队提取(这是“好的”,只要您明白这是为了仅用于测试目的)。在这里阅读更多信息:https://learn.microsoft.com/en-us/azure/kusto/management/data-ingestion/#ingestion-methods

关于azure - 通过 C# 将数据插入到 Azure 数据资源管理器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56990772/

相关文章:

azure - 无法将访客用户批量添加到 AAD 组,而我可以一次手动添加一个

c# - Azure.DocumentDb 在 HTTP 请求中找到的 MAC 签名与计算的签名不同

azure 网络作业 "The job is missing basic auth fields"

azure - 使 Invoke-AzureRmResourceAction 与暂存槽一起使用

azure - 有没有办法对 KQL 中的列表元素执行字符串运算符?

Azure KQL 正则表达式使用 extract_all() 捕获命名捕获组的句子

azure-data-explorer - 查找 Kusto 函数的最后一次使用日期

Azure 数据资源管理器 - 在删除表之前清除表数据?

azure - 如何更改数据工厂中的管道名称?

azure - 通过 KQL 在共享仪表板中使用过滤