0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Azure DataFactoryを任意のタイミングで起動する

Last updated at Posted at 2021-01-20

やりたかったこと。

  • CSVファイルが置かれると、それを加工して、自動的にSalesforceやSQLServerにインポートしたい。
  • 定期実行ではなく、おかれたタイミングで加工とインポートを行いたい。
  • プログラム書かずにやれると(後々、引き継ぎが容易になりそうで)尚良し。

自動化に使ったもの。

  • Azure LogicApps / CSVの転送、Azure DataFactoryの起動に使用。
  • Azure DataFactory / CSVの加工やSalesforce、SQLServerへのインポートに使用。

考えたこと。

  • Azure DataFactory自体は、PipelineをRESTにより、任意のタイミングで呼び出すことも可能(っぽい)
  • しかし、リファレンス見るとトークン取得までなかなか面倒。
  • なんかいい方法ないかなと思っていたら、LogicAppsにDataFactoryコネクタがあった。
  • 起動時に変数も与えられる。

設定した内容。

LogicAppsの設定UIはこんな感じ。
スクリーンショット 2021-01-20 12.01.47.png

  1. Sharepointにファイルが作られると発火。
  2. 作られたファイルの内容を取得
  3. 作られたファイルのパスから識別子を取得
  4. Blobを作成
  5. オリジナルのCSVファイルを退避
  6. Pipelineをキック。
  7. 結果を、Chatworkに投稿。

CSVファイルが作られた場所によって、DataFactoryの処理を変えたかったので、3の中でコネコネしている。
pipelineキック時の引数は以下Parametersでjson形式で指定する。
screen2.png

受け取る側のDataFactory pipelineは、以下のように変数CsvModeを定義して待っておく。
スクリーンショット 2021-01-20 12.14.09.png

Switchアクティビティでは、以下のように、CsvMode変数の値によって後続するアクティビティを指定する。
スクリーンショット 2021-01-20 12.14.42.png

以上。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?