일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- SAP
- Programming
- 딥러닝
- nodejs
- 도커
- SAP ERP
- JavaScript
- 자바
- 유럽여행
- Spring Framework
- Mac
- oracle
- sap mm
- 영어
- IT
- 오라클 디비
- ABAP
- Java
- SAP ABAP
- docker
- 비지니스영어
- 자바스크립트
- 오라클
- 머신러닝
- Python
- node.js
- Oracle DB
- db
- 파이썬
- 노드
- Today
- Total
JIHYUN JEONG
[Spotify Data Analysis/스포티파이 데이터 분석] AWS Athena 테이블 만들기(5) 본문
[Spotify Data Analysis/스포티파이 데이터 분석] AWS Athena 테이블 만들기(5)
StopHyun 2020. 3. 18. 11:39AWS Athena는 Presto 기반으로 한 빅데이터 분석 도구입니다.
AWS S3에 쌓여 있는 log에 바로 query를 실행 할 수 있다는게 가장 큰 장점중에 하나이다.
프레스토 (SQL 질의 엔진) - 위키백과, 우리 모두의 백과사전
위키백과, 우리 모두의 백과사전. 프레스토(Presto)는 페이스북이 개발한 빅 데이터 분석도구로, 분산된 SQL 쿼리 엔진이다. 기존 분석도구인 하이브/맵리듀스에 비해 CPU 효율성과 대기 시간이 10배 빠르다고 발표했다. '최소 비용으로 효율적인 컴퓨팅 인프라를 구축'하자는 오픈컴퓨트 프로젝트의 일부로, 2013년 11월 7일 아파치 라이선스로 공개되었다.[1] 2014년 1월에는 프레스토를 클라우드 기반으로 서비스하는 스타트업인 '큐볼(Qubole)
ko.wikipedia.org
1. 서비스 > 분석 > Athena를 선택합니다.

2. Get started

3. 위에 set up a query result location in Amazon S3 클릭
4. S3 에서 만든 버킷의 query result location 지정을 합니다.
- 예) s3://spotify-data-artist/

5. 그리고 database를 하나 만들어 줍니다.

6. 이제 테이블을 하나 만듭니다. (예시)
create external table if not exists top_tracks(
id string,
artist_id string,
name string,
popularity int,
external_url string
) partitioned by (dt string)
stored as parquet location 's3://spotify-data-artist/top-tracks/' tblproperties ("parquet.compress"="SNAPPY")

아래 명령어를 꼭 써줍니다.
- MSCK REPAIR TABLE top_tracks (파티션즈가 추가 될 때 )
7. 쿼리는 통해서 select를 해보았습니다.

[참고 - 사용한 쿼리]
create external table if not exists top_tracks(
id string,
artist_id string,
name string,
popularity int,
external_url string
) partitioned by (dt string)
stored as parquet location 's3://spotify-data-artist/top-tracks/' tblproperties ("parquet.compress"="SNAPPY")
MSCK REPAIR TABLE top_tracks
select * from top_tracks
where cast(dt as date) >= current_date - INTERVAL '7 'DAY
limit 10
create external table if not exists audio_features(
id string,
danceability double,
energy double,
key int,
loudness double,
mode int,
speechiness double,
acousticness double,
instrumentalness double
) partitioned by (dt string)
stored as parquet location 's3://spotify-data-artist/audio-features/' tblproperties ("parquet.compress"="SNAPPY")
MSCK REPAIR TABLE audio_features
select * from audio_features limit 10
select avg(danceability), avg(loudness)
from audio_features
where cast(dt as date) = current_date