0
0

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 5 years have passed since last update.

IBM Lift CLIを試してみた

Last updated at Posted at 2019-12-17

IBM Lift を Windows PC にダウンロード・導入し、Liftコマンドを使用して、
Db2 Warehouse on Cloudにデータをアップロード&loadした結果についてまとめました。

※当記事は、2019年3月に試したものです。現在の仕様とは異なる可能性があります。

IBM Lift CLI 
https://www.lift-cli.cloud.ibm.com/#download
:point_up_2_tone2:コチラから入手してダウンロード。
同URLのDocGetting StartedCommand Reference を参照して試しました。

1. lift put で Db2 Warehouse on Cloud 上にデータファイルをアップロード

・実行コマンド  

lift put --file C:\tpchdata\lineitem.tbl --properties-file C:\tpchdata\put.cfg

-put対象ファイルは lineitem.tbl
-コマンド・オプションは、任意で作成した設定ファイル put.cfg ファイルで指定

・put.cfg (設定ファイル)

target-user=testuser
target-password=abcdabcdabcd
target-host=xxxx.bluemix.net

※下記のように、設定ファイルを使用せず、
コマンド実行時に、'--'を付けてそれぞれ指定することも可能

・例

lift put --file C:\tpchdata\lineitem.tbl --target-user=testuser --target-password=abcdabcdabcd --target-host=xxxx.bluemix.net

参考) 実行完了時の出力

lift put --file C:\tpchdata\lineitem.tbl --properties-file C:\tpchdata\put.cfg
Putting file C:\tpchdata\lineitem.tbl (size 22GB) at a maximum throughput of 500.00 Mb/s.
[##########] Put 22/22 GB at 14.47 Mb/s (0 sec remain)
Transferred file C:\tpchdata\lineitem.tbl in 46 minutes 31 seconds at average throughput of 68.24 Mb/s.
The file transfer completed successfully.

※サマリーや製品ログファイルが、binディレクトリー配下に作成された「runxxxx」というフォルダに作成されていた

2.  lift load で BLUDBのテーブルにロード

C:\Program Files\IBM\Lift\bin>lift load --filename lineitem.tbl --properties-file C:\tpchdata\load.cfg

-load対象ファイルは lineitem.tbl
-コマンド・オプションは、任意で作成した設定ファイル load.cfg ファイルで指定

・load.cfg (設定ファイル)

target-schema=DB2INST1
target-table=LINEITEM
file-origin=user
target-user=testuser
target-password=abcdabcdabcd
target-host=xxxx.bluemix.net
field-delimiter=|

※target-schema と tagert-table を小文字で実行した際、「テーブルが存在しない」というエラーになりました。

参考) 実行完了時の出力

C:\Program Files\IBM\Lift\bin>lift load --filename lineitem.tbl --properties-file C:\tpchdata\load.cfg
Loading file lineitem.tbl into DB2INST1.LINEITEM
Loaded file lineitem.tbl into "DB2INST1"."LINEITEM" in 1085 seconds
Load Id: 1553011248620
Details
  Rows loaded: 179998372
  Rows skipped: 0
  Rows rejected: 0
  Rows deleted: 0

【参考情報】
◆liftでputしたファイルの一覧を確認したいとき

lift ls 

※ --target-user xx --target-password xx --target-host xx の指定が必要。

以下は、put.cfgを指定した実行例

C:\Program Files\IBM\Lift\bin>lift ls --properties-file C:\tpchdata\put.cfg
lineitem.tbl
part.tbl
lineitem01.tbl.aspx ←途中でアップロードが中断した場合に作られたように思われる
…

◆liftでputしたファイルの削除したいとき

lift rm 

※ -f で削除対象のファイル名と--target-user xx --target-password xx --target-host xx の指定

以下は、put.cfgを指定した実行例

C:\Program Files\IBM\Lift\bin>lift rm -f lineitem01.tbl.aspx --properties-file C:\tpchdata\put.cfg
File 241_lineitem.tbl.aspx successfully deleted
1 files successfully deleted

◆lift コマンドのヘルプ

"--help " でオプション各種が確認できます。

lift --help
0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?