使用逻辑应用读取 azure blob 存储文件夹中的文件列表,并将带扩展名的文件名插入 Azure SQL

问题描述

我正在学习 Azure 逻辑应用工作流程,我已将存档解压缩到 Blob 存储中的文件夹中。

现在,我需要读取提取路径中带有扩展名的文件名,并将这些文件名插入到 Azure sql 数据库中。

请帮助我实现这一目标。

解决方法

要实现这个要求,可以参考我下面的步骤:

1. 使用“List blobs”列出存储文件夹中的所有 blob。

enter image description here

2. 然后在逻辑应用中添加“For each”循环以循环“List blob”中的值。在“For each”循环中,使用“Insert row(V2)”将每个文件名插入到你的sql表中。

enter image description here

顺便说一下,在 step2 之前,我已经在我的 azure sql db 中创建了一个名为 FilesTable 的表,如下图所示:

enter image description here

当您使用“For each”循环插入行时,我们最好启用“并发控制”并将Degree of Parallelism设置为1以逃避并发问题。请按以下步骤操作:

enter image description here

enter image description here