ColaboratoryでTreasure Data にクエリを投げる
1380 ワード
Colaboratoryというhosted Jupyter + Google Driveなど連携などがされた便利なサービスがfree to useで提供されています。
Is it free to use?
Yes. Colaboratory is a research project that is free to use.
https://research.google.com/colaboratory/faq.html
なので、下記の手順でTreasure Dataにクエリを投げれます。
Colaboratoryでは任意のライブラリをインストールするには、!pip install
を利用します。
つまり、
!pip install td-client
で、https://github.com/treasure-data/td-client-python のインストールが可能です。
あとは、下記のようにしてクエリが投げれますね。簡単。
import tdclient
with tdclient.Client(apikey='<YOUR APIKEY>') as td:
job = td.query("sample_datasets", "SELECT COUNT(1) FROM www_access", type="presto")
job.wait()
for row in job.result():
print(repr(row))
Author And Source
この問題について(ColaboratoryでTreasure Data にクエリを投げる), 我々は、より多くの情報をここで見つけました https://qiita.com/toru-takahashi/items/2ac1e49ed88fe1a2f39a著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .