LoginSignup
0
1

More than 5 years have passed since last update.

PythonからAzure HDInsightのHiveを使ってデータ取得

Last updated at Posted at 2018-09-12

やりたいこと

  • Azure HDinsightクラスタのHiveでAzure Data Lake Storeに格納しているデータファイル (e.g., TSVファイル)を読み込む
    • HiveはPythonから呼びたい
    • 取得したデータはPandasのDataFrameとして扱いたい

全体の流れ

  1. Azure VMの作成
  2. Azure VMでJupyter Notebookを起動
  3. Notebookをアップロード

Azure VMの作成

ここは僕知らない、やってもらったから
こちらを参考にすれば作成できそう
Linux仮想マシン | Microsoft Doc

Azure VMでJupyter Notebookを起動

こちらの[接続]ボタンの左の[開始]ボタンがVM起動のためのボタン
Linux仮想マシン - 仮想マシンへの接続 | Microsoft Doc

PythonからHiveのクエリを投げるためのJupyter Notebook

Submit Queries to Azure HDInsight Hive Cluster in Jupyter Notebooks | Azure AI Gallery

Jupyter NotebookをVM上で起動

上のNotebookをUpload

実行しても以下のエラーが出た

ImportErrorTraceback (most recent call last)
<ipython-input-1-7e15b2d6f6c9> in <module>()
     11 # You need the Azure SDK package to download the stdout of hive queries
     12 # which is stored in Azure blob.
---> 13 from azure.storage.blob import BlobService
     14 warnings.filterwarnings("ignore", category=UserWarning, module='urllib2')
     15 

ImportError: No module named azure.storage.blob

これを参考にパッケージ入れ直してみる

Install Azure Python api on linux: importError: No module named storage.blob
- SrtackOverflow

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