如何构建用于文件验证检查和发送错误邮件的 Azure 数据工厂和 Azure 函数

How to build Azure Data Factory and Azure functions for file validation check and sending error mail

我在管道中有一个 Azure 数据工厂副本 activity。 副本 activity 正在运行。我有两个问题。 第一个问题是如何构建 Azure 数据工厂或 Azure 函数来执行以下任何流程。

  1. 将上传的 csv 文件或 excel 文件复制到另一个容器。
  2. 对 python 编码的 azure 函数执行验证检查。
  3. 将包含错误消息的邮件作为附件发送,该文件由 Azure 发送网格针对 SMTP 的验证检查生成。
  4. 如果验证检查没有问题,将该文件复制到 SQL 数据库 table。

非常感谢您的提前配合。

根据我的理解,在下面回答您的问题。如果您需要其他内容或更多详细信息,请随时澄清。

Copy uploaded csv files or excel file to another conteiner.

使用 Copy Data,源 blob 作为输入,目标 blob 作为输出

Thank you. I got it. also I I could implement this.  

Execute validation check of azure function for that coded by python

在数据工厂中使用 Azure Function activity 调用您的 http 触发 功能(假设您的意思是对文件进行验证检查 uploading/copying?)

Yes, I do. the file is same file which I uploaded and copied. How can I use a Message Queue trriger ? I hope to use a trriger of copy complete queue because of big file.

您不需要队列来处理自己。您可以使用内置的 Blob Trigger,这将使您的生活更轻松。

Send the mail included error messages as attached file generated by the validation check by Azure send grid for SMTP.

您可以使用相同的 python Azure 函数通过 SendGrid 发送电子邮件 SendGrid binding. But function binding does not support attaching file in mail. For that you can write custom code using SendGrid SDK 而不是使用内置绑定。

I didn't know that function bindind does not supprt attaching file. I try to use sendgrid SDK and API

SendGrid API Should I also see the reference like below link ? attachments

是的,你可以。我相信那是 REST API 规范。如果您使用 SendGrid SDK,它将为您处理。

If there is no problem with the validation check, copy that file to SQL database table.

您的意思是在某些 SQL table 列中将文件保持为二进制文件?尽管您可以在技术上将其存储在 varbinary 类型列中。但我建议存储 blob link 而不是将整个文件存储在 SQL 中。您可以在管道中使用 SQL activity 来调用将 blob link 作为参数传递的存储过程。

My comment had included miss word. the below is right. If there is no problem with the validation check, copy the information in file to SQL database table becase I need to analysis the data after my accumulation of data. I can not know that How to set the trigger of migration process to SQL database. Is it better that I use that message queue of copy complete of Strage blob as output ?.

如上所述,您不需要自定义队列,因为数据工厂已经有 trigger 来帮助您。