指定 Azure blob 虚拟文件夹而不是文件以引入 Kusto

specifying Azure blob virtual folder instead of file for ingesting into Kusto

参考 .ingest into table <tablename> 功能,根据文档,我们需要指定直接文件名 (blob)。但更常见的是,我们可能在给定的 blob 路径中有一堆文本文件,所有这些文件都需要导入。有没有办法指定路径?我已尝试指定,但 Kusto 不喜欢文件夹路径。

Kusto 不会迭代文件夹或容器。

将所有文件压缩到一个文件中。放在斑点上。这个 [ingest into] 命令对我有用:

.ingest into table Blah ( 
h@'https://YOURACCOUNT.blob.core.windows.net/somefolder/FileFullofCsvs.zip;YOURKEY'
) 
with (
format = "csv",
ignoreFirstRecord = true,
zipPattern="*.csv"
)

您可以通过创建外部 table 引用您的 blob 存储文件夹来实现此目的。

  1. 生成 SAS 令牌。

为您的 blob 存储文件夹生成 SAS 令牌。 (确保 select 读取和列出权限以及任何其他适当的权限)

  1. 创建外部table

这是 Kusto 查询

.create external table myExternalTable(ProductID:string, Name:string ,Description:string, ExpiryDate:datetime)
kind=blob
dataformat=csv
(
  h@'https://{storageaccount}.blob.core.windows.net/{file system}/{folder name}?{SAS token url generated from step1}
)
  1. 在 Azure 数据资源管理器数据库中创建 Table

将数据设置或附加到 Azure 数据资源管理器数据库 table。

.set-or-append myProductTable (extend_schema=true) <|external_table("myExternalTable")
  1. 查询table

这将列出 table

中的所有数据行
myProductTable