LoginSignup
1
1

More than 5 years have passed since last update.

[Heroku] HerokuからTreasureDataへデータを登録する [TreasureData]

Posted at

なにはともあれ、ビッグデータの保管先にはいろいろと考えさせられますが、 Heroku では、TreasureData が簡単に利用できます(高いけど)。しかも、とにかく「カンタン」です。本日は、 「HerokuからTreasureDataへデータを送る方法」をご説明します。

標準出力に出力するだけ

はい、それだけです。もちろん決めごとはありますが、大した話ではありません。データ形式は Json である必要があります。

以下、 Ruby のサンプルコードです。

Sample
puts "@[production.login] #{{'uid'=>123}.to_json}"
puts "@[production.follow] #{{'uid'=>123, 'from'=>'@TreasureData', 'to'=>'@Heroku'}.to_json}"
puts "@[production.pay] #{{'uid'=>123, 'item_name'=>'Stone of Jordan', 'category'=>'ring', 'price'=>100, 'count'=>1}.to_json}"

フォーマットは

"@[ database . table ] json"

となります。

  • database : TreasureData のデータベース名
  • table : TreasureData のテーブル名
  • json : 登録したいデータ (json型のみ)

ということが、Heroku Dev Center に記載してありますので、英語読めれば一瞬です。以上

You can import data to Treasure Data by simply writing to STDOUT with a specific format.
Data Import: just write to STDOUT!

気になる点があるとすると、登録までに数分かかるので、初めて実行したときは「ホントに TreasureData へデータ送られてるんか...」と心配になりますが、そんなもんです。

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