win 10 에서 apache 슈퍼 set 사용

공식 문서:http://superset.apache.org/
환경 준비
python 3 즉 3.4 이상 버 전 설치 
2. python 은 슈퍼 set 용기 로 가상 환경 을 만 듭 니 다.
-pip3 install virtualenv

가상 환경 만 들 기:        -(1)virtualenv env_슈퍼 setobj (가상 환경 만 들 기)
   -(2)virtualenv  env_supersetob (청정 환경 만 들 기)        -(3)virtualenv --system-site-packages env_슈퍼 setobj (환경 생 성, 원래 설 치 된 모듈 계승)    이 가상 환경 활성화:        -windows 디 렉 터 리 에 들 어 가 는 Script 폴 더 입력: activate        -linux:soruse env1/Script/activate    가상 환경 종료:        -deactivate    pycharm 에서 가상 환경 사용 하기        -files - settings - Project Interpreter - add 가상 환경 경로 의 python. exe 를 선택 하면 됩 니 다.
3. 설치 VS 2015
Superset 에서 의존 하 는 일부 라 이브 러 리 는 microsoft visual c + 2010 컴 파일 을 사용 해 야 합 니 다.
설명 에 의 하면 설치 도 가능 할 것 같 아 요. Visual C++ 2015 Build Tools:  
       http://landinghub.visualstudio.com/visual-cpp-build-tools
4. 패키지 설치 실패
이곳 은 큰 구덩이 다. 제 가 슈퍼 셋 을 직접 설치 하 는 데 성공 하지 못 했 습 니 다. 오류 가 발생 했 습 니 다. pandas 버 전과 관련 이 있 습 니 다.
해결 방법 은: 통과 http://www.lfd.uci.edu/~gohlke/pythonlibs/#sasl 해당 버 전 다운로드
예 를 들 어 우리 가 설치 한 python. 3.6 버 전, 시스템 64 위, sasl - 0.2.1 - cp36 - cp36m - win 다운로드amd64.whl。
  
또 설치 과정 에서 나 타 났 다 "고 말 했다. Failed building wheel for xxx "의 해결 방법 은 다음 과 같다.
발생 원인: 해당 whl 파일 이 없습니다.
해결 방법: 해당 하 는 whl 파일 을 다운로드 하고 설치 합 니 다.
나타나다 Failed building wheel for python geohash "는 해당 python 버 전의 python 을 다운로드 합 니 다.geohash 파일.
 
예 를 들 어 Python 3.6 버 전 은 python 을 찾 습 니 다.geohash-0.8.5-cp36-cp36m-win_amd 64. whl 파일 을 다운로드 하면 됩 니 다.
pip install F:\python_geohash-0.8.5-cp36-cp36m-win32.whl 

슈퍼 셋 설치
1. 설치
pip install superset

2. 관리자 계 정 만 들 기
fabmanager create-admin --app superset

3. 데이터베이스 초기 화
진보적이다 Python 설치 디 렉 터 리 (또는 virtualEnv 의 가상 디 렉 터 리) 에서 lib \ site - packages \ \ superset \ bin 아래
python  superset db upgrade

4. 예 불 러 오기
후속 작업 은 lib \ site - packages \ superset \ \ bin 에서 해 야 합 니 다.
python superset load_examples

5. 캐릭터 와 권한 초기 화
python superset init

6. 서비스 시작
포트 8088, 쓰다 -p 포트 번호 변경
python superset runserver -d

6. 데이터 원본 설정
Superset 는 기본적으로 sqllite 를 사용 합 니 다.다음 데이터베이스 지원:
MySQL
pip install mysqlclient
mysql://
Postgres
pip install psycopg2
postgresql+psycopg2://
Presto
pip install pyhive
presto://
Oracle
pip install cx_Oracle
oracle://
sqlite
 묵인 하 다
sqlite://
Redshift
pip install sqlalchemy-redshift
postgresql+psycopg2://
MSSQL
pip install pymssql
mssql://
Impala
pip install impyla
impala://
SparkSQL
pip install pyhive
jdbc+hive://
Greenplum
pip install psycopg2
postgresql+psycopg2://
Athena
pip install "PyAthenaJDBC>1.0.9"
awsathena+jdbc://
Vertica
pip install sqlalchemy-vertica-python
vertica+vertica_python://
ClickHouse
pip install sqlalchemy-clickhouse
clickhouse://
 
pip 를 사용 하여 데이터 베 이 스 를 설치 하면 웹 인터페이스 에서 관련 데이터 원본 을 설정 할 수 있 습 니 다.
데이터베이스 연결 문자열 형식 참조:http://docs.sqlalchemy.org/en/rel_1_0/core/engines.html#database-urls 
7. charts 선택
데이터 원본 을 선택 한 후 데이터 원본 의 데이터 시트 를 추가 합 니 다.
그리고 도표, 스타일 색상 선택 등 을 설정 합 니 다.간판 을 통 해 여러 개의 도 표를 집합 할 수 있다.
8. 삽입 배경 응용
1. 프로필 수정
슈퍼 set 의 config. py 프로필 을 수정 하여 PUBLICROLE_LIKE_GAMMA 는 트 루 로 바 뀌 었 다.
설명:
공통 캐릭터 에 GAMMA 캐릭터 와 동일 한 권한 집합 을 부여 합 니 다.
익명 의 사용자 에 게 보 여 주 려 면 여 기 를 설정 하고 계기판 에서 특정 데이터 세트 에 대한 권한 수여 디 스 플레이 도 여기에 설정 할 수 있 습 니 다.
2. X - Frame - Options 제한 을 없 애고 iframe 크로스 오 버 방문 문 제 를 피한다.
안전
안전 - > 캐릭터 리스트
권한 설명:
can explore on Superset 내 보 내기 도표 로
can explore json on Superset 도표 내 보 내기 json
  all database access on all_database_access 모든 데이터베이스 에 접근 할 수 있 는 권한 도 설정 할 수 있 습 니 다.
10. iframe 을 가 져 와 html 를 보 여 줍 니 다.
1. 설정 후 슈퍼 셋 오른쪽 상단 에서  ">" 단 추 를 누 르 면 url 주 소 를 얻 을 수 있 습 니 다.
2. 그리고 보 여줄 페이지 에서
<iframe
  width="600"
  height="400"
  seamless
  frameBorder="0"
  scrolling="no"
src="xxxxxxxxxxxx"
>
iframe>

3. superset 도표 URL 로 재 설정
왜 방향 을 바 꿔 야 합 니까?여 기 는 배경 에 슈퍼 set 의 도표 링크 를 숨 기 고 스 캔 된 후에 악의 적 으로 사용 하 는 것 을 방지 하기 위해 서 입 니 다.백 스테이지 에서 권한 제어 가 가능 한 요청 링크 를 다시 작성 하고 슈퍼 set 의 도표 링크 로 다시 설정 하면 데이터 유출 을 방지 할 수 있 습 니 다.
4. 동적 매개 변수 상호작용
슈퍼 set 도표 가 제공 하 는 링크 주 소 는 json 을 매개 변수 로 전달 합 니 다.
예:
form_data={"datasource":"3__table","viz_type":"line","slice_id":63,"granularity_sqla":"ds","time_grain_sqla":null,"since":"100 years ago","until":"now","metrics":[{"aggregate":"SUM","column":{"column_name":"num_california","expression":"CASE WHEN state = 'CA' THEN num ELSE 0 END"},"expressionType":"SIMPLE","label":"SUM(num_california)"}],"adhoc_filters":[{"expressionType":"SIMPLE","subject":"gender","operator":"==","comparator":"boy","clause":"WHERE","sqlExpression":null,"fromFormData":true,"filterOptionName":"filter_gtzm93u9ocq_9sy5vd5ocfg"},{"expressionType":"SIMPLE","subject":"name","operator":"LIKE","comparator":"Aaron","clause":"WHERE","sqlExpression":null,"fromFormData":true,"filterOptionName":"filter_6cgdixdoh3_5wrgyuorwoa"}],"groupby":["name"],"limit":"10","timeseries_limit_metric":{"aggregate":"SUM","column":{"column_name":"num_california","expression":"CASE WHEN state = 'CA' THEN num ELSE 0 END"},"expressionType":"SIMPLE","label":"SUM(num_california)"},"order_desc":true,"contribution":false,"row_limit":50000,"color_scheme":"bnbColors","show_brush":"auto","show_legend":true,"rich_tooltip":true,"show_markers":false,"line_interpolation":"linear","x_axis_label":"","bottom_margin":"auto","x_ticks_layout":"auto","x_axis_format":"smart_date","x_axis_showminmax":false,"y_axis_label":"","left_margin":"auto","y_axis_showminmax":false,"y_log_scale":false,"y_axis_format":".3s","y_axis_bounds":[null,null],"rolling_type":"None","time_compare":[],"num_period_compare":"","period_ratio_type":"growth","resample_how":null,"resample_rule":null,"resample_fillmethod":null,"annotation_layers":[],"compare_lag":"10","compare_suffix":"o10Y","markup_type":"markdown","metric":"sum__num","where":"","url_params":{}}

 
  

좋은 웹페이지 즐겨찾기