4
1

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

Superset on DockerからAthenaに接続する方法

Posted at

概要

業務でサポートしているチームがSupersetを試してみる(データソースは、Athenaにある)ことになったが、接続方法の情報があまりなかったので、備忘録の意味でまとめる。

Superset自体の説明は必要に応じて別途記載するかも。

参考)公式のSuperset Docker・・・ただし、これを直接は使わない

URL
https://hub.docker.com/r/apache/superset

インストール手順

公式のGitHubから、一式Cloneする。

URL
https://github.com/apache/superset

$ git clone https://github.com/apache/superset.git

AthenaのドライバーをDockerBuild時にインストールするように仕込む

参考URL:
https://superset.apache.org/docs/databases/dockeradddrivers

↑この記事は、MySQL Driverを例にしているが、これをAthenaに置き換えれば良い。(PyAthenaを使う)

# git clone したルートディレクトリで行う
$ touch ./docker/requirements-local.txt
$ echo "PyAthena" >> ./docker/requirements-local.txt
$ sudo docker-compose -f docker-compose-non-dev.yml up

Databaseの接続設定

SupersetのGUIで行う(sample_dwhというDatabaseにつなぐ前提で記載)

  • メニューのDaba>Databasesで、Database一覧画面に遷移する

  • 右上の「+ DATABASE」 というボタンを押す

  • Connect a databaseというダイアログ画面が出るので、以下の入力をする。

    • DISPLAY NAME (任意の分かりやすい名前で良い)
    • SQLALCHEMY URLは、下記の書式で入れる
awsathena+rest://<AWSのアクセスキー>:<シークレットキー>@athena.ap-northeast-1.amazonaws.com/sample_dwh?s3_staging_dir=s3%3A//sample-dwh-sandbox-123456789012-ap-northeast-1/

書式の説明サイトは、ここ(分かりづらいけど)

https://superset.apache.org/docs/databases/athena

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?