LoginSignup
1
1

More than 1 year has passed since last update.

Talend Pythonスクリプトを実行する

Last updated at Posted at 2021-08-24

はじめに

talendでpythonや別のプログラムを実行する方法を記載。
CMDにPython環境の構築とライブラリのインストールが必要です。

ディレクトリ

.
├── iris.csv
├── sample.py
├── TOS_DI-Win32-20200219_1130-V7.3.1

実行するPythonコード

Pandasライブラリを利用してiris.csvを読み込みdummy.csvを出力するのみ。
用途に合わせてPandasの実装が入る想定です。

sample.py
import pandas as pd

# input
df = pd.read_csv("C:\\talend\\iris.csv")

# ここで用途に合わせてpandasでデータの整形を実装

# output
df.to_csv("C:\\talend\\dummy.csv",header=True,index=False, encoding='utf-8')

使用コンポーネント

tFileExist
事前に使用するファイルがあるかを確認しています。
今回はContextsに確認するファイルを定義しています。

image.png

tSystem
単独コマンドを使用にチェック
コマンドに実行するコマンドを入力

"Python \"C:\\talend\\sample.py"

image.png

ジョブ実行

Pythonでprint等を記述するとtalendのコンソールに表示されるはずです。
image.png

1
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
1
1