'데이터 엔지니어'로 성장하기

정리하는 걸 좋아하고, 남이 읽으면 더 좋아함

Data/Superset

superset) trino 연결해서 그래프 그리기

MightyTedKim 2023. 4. 23. 15:56
728x90
반응형

superset에서는 pip install만 하면 db connection을 만들 수 있어요.

그런데 어떻게 추가하는지 처음에는 당황스러울 수 있어요

 

예상 독자는 아래와 같아요.

  • superset에 connection 맺으려고, dockefile 예시 찾는 분

Superset 이 무엇인지 설명하는 이전 글은 아래 링크에 있어요

https://mightytedkim.tistory.com/191

 

Supserset) 슈퍼셋 들어보셧나요? 사용 후기 듣고 가세요! (filter 조건 위치 변경해서 full scan 방지)

요즘 '빅데이터 지탱하는 기술' 보고 있는데, superset이 나와서 정리해봣어요예상 독자는 아래와 같아요 - superset 사용하시려는 분 - 기본 구조를 아시고 싶으신 분 - filter를 where절 안에서 사용하

mightytedkim.tistory.com


superset에서 connection 맺기

버전마다 조금 다른 것  같은데 우측 상단의 + 버튼에 있어요

다양한 connection 을 맺을 수잇는데, dropdown으로 검색된다고 되는게 아니에요

pip install 을 통해서 PyPi 패키지를 넣어줘야해요.

그러기 위해서는 Dockerfile에 아래 명령어들을 추가해야해요

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

trino를 사용하려고, 제가 사용한 Dockerfile은 아래와 같아요

 

# Switching to root to install the required packages
USER root
# Example: installing the MySQL driver to connect to the metadata database
# if you prefer Postgres, you may want to use `psycopg2-binary` instead
#RUN pip install mysqlclient
# Example: installing a driver to connect to Redshift
# Find which driver you need based on the analytics database
# you want to connect to here:

https://superset.apache.org/installation.html#database-dependencies
#RUN pip install sqlalchemy-redshift
# Switching back to using the `superset` user
RUN  https_proxy=http://168.219.61.252:8080 http_proxy=http://168.219.61.252:8080 pip --trusted-host pypi.org --trusted-host files.pythonhosted.org install --no-cache-dir \
      install --upgrade pip
RUN  https_proxy=http://168.219.61.252:8080 http_proxy=http://168.219.61.252:8080 pip --trusted-host pypi.org --trusted-host files.pythonhosted.org install --no-cache-dir \
      install sqlalchemy-trino

USER superset

 

빌드를 하고 

  284  docker build --tag deet1107/apache_superset:1.5.3-trino ./
  285  docker push  deet1107/apache_superset:1.5.3-trino 

 

helm의 value.yaml을 아래처럼 수정했어요

다시 배포하고 나서 확인하면, connection이 맺어집니다

성공하면 우측 하단에 connection looks good이 나오고, 아니면 다양한 에러메시지가 나와요

테스트를 위해서 sql lab, chart를 만들어봤어요.

키바나와 비교해서는 생각보다 러닝커브가 있는 것 같아요.

 

쓰고 나니까 dockerflile에 커넥션 맺는 코드 한줄 추가했을 뿐이네요 ㅋㅋ

 

728x90
반응형