ãã®è¨äºã¯
æ¢ã« 2018 å¹´ã ãã©...
åè丸 Advent Calendar 2017 21 æ¥ç®ã®è¨äºã§ã.
re:dash ã¨ã¯
ãã£ãã, rehash ã¨æã£ã¦ãã¾ããã¨ãã°ãã°. ã¡ãªã¿ã«, re:dash ã®æ£å¼ãªè¡¨è¨ã¯ãredashããªã®ããredashããªã®ã, ãRe:dashããªã®ãå¤ããªãã£ãã®ã§, æ¬è¨äºã§ã¯ re:dash
ã§çµ±ä¸ãããã¨æã.ï¼æ£å¼ãªè¡¨è¨ãããã°æãã¦ãã ãããï¼
OSS ã§æä¾ããã¦ããããã·ã¥ãã¼ãçæãã¼ã«ã§, ãã¼ã¿ã½ã¼ã¹ã¯ MySQL ã PostgreSQL çã® RDMS ã«å§ã¾ã£ã¦, Amazon RDS ã® Aurora ã Elasticsearch ã Google BigQuery, Graphite ãæå®ãããã¨ãåºæ¥ã.
å人çã«ã°ãã¨ããã®ã¯, ãã¼ã¿ã½ã¼ã¹ã¨ã㦠Graphite ã Elasticsearch ãå©ç¨åºæ¥ãç¹, ãã㦠Python ã³ã¼ããå®è¡åºæ¥ãç¹. æ¸ãã¦ããã ãã§ã¯ã¯ã¯ã¯ãã.
re:dash 㯠OSS çãä»»æã®ç°å¢ã«å±éãã¦å©ç¨ããã, ãã¹ãã£ã³ã°ãµã¼ãã¹ãæä¾ããã¦ããããã§, èªåéã§ãµã¼ãã¼ããªã½ã¼ã¹ã管çããã®ããã«ãå ´åã re:dash 使ããããã©, ãµã¼ãã¼ã¯è½ã¨ããããªãã¨ãã顧客ç¸æã«ã¯ãã¹ãã£ã³ã°çãé¸æè¢ã¨ãã¦æ¤è¨åºæ¥ãã¨æã.
re:dash ãä½é¨ãã
ãã³ãºãªã³è³æ
以ä¸ã®ãã³ãºãªã³è³æãå©ç¨ããã¦é ãã¦ä½é¨ãã.
ãã³ãºãªã³ç°å¢
以ä¸ã®ç°å¢ã§ãã³ãºãªã³ãä½é¨ãã.
$ sw_vers ProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G17023 $ docker version Client: Version: 17.09.0-ce API version: 1.32 Go version: go1.8.3 Git commit: afdb6d4 Built: Tue Sep 26 22:40:09 2017 OS/Arch: darwin/amd64 Server: Version: 17.09.0-ce API version: 1.32 (minimum version 1.12) Go version: go1.8.3 Git commit: afdb6d4 Built: Tue Sep 26 22:45:38 2017 OS/Arch: linux/amd64 Experimental: false $ docker-compose version docker-compose version 1.16.1, build 6d1ac21 docker-py version: 2.5.1 CPython version: 2.7.12 OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016
ç°å¢æ§ç¯
ãã³ãºãªã³è³æã«å¾ã£ã¦, Docker Compose ã§æ§ç¯ãã.
$ git clone https://github.com/kakakakakku/redash-hands-on.git $ cd redash-hands-on $ docker-compose run --rm server create_db $ docker-compose up -d
è³æã§ã¯ docker-compose up
ã¨æ¸ããã¦ãããã©, ãã¿ããã¢ã¼ãã§èµ·åãã.
ãã°ã¤ã³
ãã©ã¦ã¶ã§ http://localhost ã«ã¢ã¯ã»ã¹ããã¨ä»¥ä¸ã®ããã«ï¼
Email ã Password ã¯è³æéãã«.
ãã¼ã¿ã½ã¼ã¹
ãã¼ã¿ã½ã¼ã¹ã®æå®ã§, ä¸ç¬ã ãããã¼ã¿ã½ã¼ã¹ãã¿ã³ãã£ã¦ã©ããªã®ï¼ã£ã¦æã£ãããã¤ã¤, è³æéãã« MySQL ãæå®ãããã¨ãåºæ¥ã.
ã¯ã¨ãªãä½ã£ã¦, ã°ã©ãããµã¯ãã¨ä½ããã¨ãåºæ¥ã
以ä¸ã®ããã«, New Query ãã¯ãªãã¯ãã¦ã¯ã¨ãªãå ¥åãã.
æ¢ã«ãã¼ã¿ãã¼ã¹(world)ãç¨æããã¦ããã®ãå¬ããéã.
è³æã«å¾ã£ã¦, 以ä¸ã®ãããªã¯ã¨ãªã試ãã¦ã¿ã.
-- å½ã®ä¸è¦§ SELECT * FROM country; -- å½ã®ä»¶æ° SELECT COUNT(*) AS COUNT FROM country; -- å½ã®ä»¶æ°ï¼+ ç®æ¨å¤ï¼ SELECT COUNT(*) AS COUNT, 500 AS kpi FROM country; -- é½å¸ã®ä»¶æ° SELECT CountryCode, COUNT(*) AS COUNT FROM city GROUP BY CountryCode ORDER BY COUNT DESC;
以ä¸ã®ããã«, ã¯ã¨ãªãå®è¡ãã¦, ã¯ã¨ãªã«å¯¾ã㦠Visualization Editor ã§ç´ãã«å¯è¦åãåºæ¥ã.
以ä¸ã¯é½å¸ã®ä»¶æ°ãåã°ã©ãã«ããå®è¡ä¾.
ããæã.
åãã¯ã¨ãªãå©ç¨ãã¦æ£ã°ã©ããä½æãããã¨ãåºæ¥ã.
ãã©ã¡ã¼ã¿æ©è½
ã¯ã¨ãªå
ã« {{}}
ãå«ããã¨, ã¯ã¨ãªã«ãã©ã¡ã¼ã¿ãæå®ãããã¨ãåºæ¥ãããã«ãªã.
SELECT * FROM city WHERE CountryCode = '{{CountryCode}}' ORDER BY Population DESC;
ä¸å³ã®ããã« CountryCode ã«å¯¾ãã¦ä»»æã®å¤ãæå®ãããã¨ãåºæ¥ãããã«ãªã.
ãã©ã¡ã¼ã¿ã®å ¥åé ç®ã¯ããã¹ããã£ã¼ã«ã以å¤ã«, ãã«ãã¦ã³çãæå®ãããã¨ãåºæ¥ã.
ãã«ãã¦ã³ä»¥å¤ã« Date ãé¸æããã¨, æ¥ä»ããã«ã¼ããæ¥ä»ãé¸æãããã¨ãåºæ¥ã.
ä»åã®ãã¼ã¿ãã¼ã¹ã¯æ¥ä»ã¯é¢ä¿ãªãã®ã§ã¢ã¬ã ãã©, ããã¯ä¾¿å©ããã .
ãã£ã«ã¿æ©è½
ã¯ã¨ãªã®ã«ã©ã åã ã«ã©ã å::filter
å㯠ã«ã©ã å::multi-filter
ã¨ããååã«ããã¨, ã¯ã¨ãªã®çµæã«å¯¾ãã¦ãã£ã«ã¿ãæãããã¨ãåºæ¥ã.
multi-filter
ã§è¤æ°ã®å¤ã§ãã£ã«ã¿ãããã¨ãåºæ¥ã.
ããã¾ã便å©ãã.
ãã®ä»ã®æ©è½
ãã³ãºãªã³è³æã§ç´¹ä»ããã¦ããã®ã¯, ä¸è¨ã®ãã©ã¡ã¼ã¿ããã£ã«ã¿æ©è½ä»¥å¤ã«,
- ããã·ã¥ãã¼ãã®ä½æ
- ã¯ã¨ãªã¹ããããæ©è½
- ã¯ã¨ãªçµæã«è²ãä»ãã
- ã¯ã¨ãªçµæã®ãã¦ã³ãã¼ã
- ã¯ã¨ãªã®ãã©ã¼ã¯æ©è½
- ã¢ã©ã¼ãè¨å®
ç, ç´ãã«å½¹ç«ã¤æ©è½ãã®ã¥ãã¨çºã¾ã£ã¦ãã¦, ãã®ãã³ãºãªã³è³æã ã㧠re:dash ã®ä¸»è¦ãªæ©è½ï¼ã ã¨æãããï¼ãä½æåºæ¥ãæ°ããã.
以ä¸
ç´ æ´ããããã³ãºãªã³è³æ
ç¹°ãè¿ãã«ãªãã, re:dash ã«åä½é¨ã®èªåã§ã, ãã£ã¨ããéã«ç°å¢æ§ç¯ãåºæ¥ã¦, 主è¦ãªæ©è½ãä½ããã¨ãªãä½æåºæ¥ã. æé£ããããã¾ãã.
åã㦠re:dash ã使ã£ã¦ã¿ã¦
ãã³ãºãªã³ãã£ã¦ã¿ã¦...
- ã»ããã¢ãããç°¡åããï¼ãã³ãºãªã³è³æã®ãé°ã ã¨æããã©
- SQL ããæ¸ããã°, å¯è¦åã¾ã§ã®æéãã¨ã¦ãå°ãªããã¨ãå¬ãã
- ä»å¾, èªåãåºä¼ããããªãã¼ã¿ã½ã¼ã¹ã¯ãµãã¼ãããã¦ãããã¨ãå¬ãã
- ã¯ã¨ãªã¹ãããããéç¥æ©è½çã®ç´°ããæ©è½ãå¬ãã